def test_successful_booking(self):
        _input = InputValidator("BOOK 09:30 13:15 2")
        response = self.makeSpaceService.ExecuteRequest(_input.Query)
        self.assertEqual(response, "C-Cave")

        _input = InputValidator("BOOK 09:30 13:15 2")
        response = self.makeSpaceService.ExecuteRequest(_input.Query)
        self.assertEqual(response, "D-Tower")
    def test_successful_booking(self):
        _input = InputValidator("BOOK 09:30 13:15 2")
        response = self.bookingService.BookRoom(_input.Query,
                                                self.meetingRooms)
        self.assertEqual(response, "C-Cave")

        _input = InputValidator("BOOK 09:30 13:15 2")
        response = self.bookingService.BookRoom(_input.Query,
                                                self.meetingRooms)
        self.assertEqual(response, "D-Tower")
Ejemplo n.º 3
0
def main():
    input_file = sys.argv[1]
    file = open(input_file, 'r')
    lines = file.readlines()
    
    makeSpaceService = MakeSpaceService()
    
    try:
        for line in lines:
            # Validate the incoming request
            _input = InputValidator(line)

            if _input.IsValid:
                response = makeSpaceService.ExecuteRequest(_input.Query)
                print(response)
            else:
                print("INCORRECT_INPUT")
        
    except Exception:
        pass
Ejemplo n.º 4
0
def main():
    input_file = sys.argv[1]
    file = open(input_file, 'r')
    lines = file.readlines()
    result = []
    result_set = set()

    for line in lines:
        input = InputValidator(line)
        if input.IsValid:
            if Ally.IsAlly(kingdom=input.Kingdom):
                if not input.Kingdom.Name in result_set:
                    result_set.add(input.Kingdom.Name)
                    result.append(input.Kingdom.Name)

    if len(result) < 3:
        print("NONE")
    else:
        print("SPACE", end=" ")
        for items in result:
            print(items, end=" ")
Ejemplo n.º 5
0
 def test_start_time_minutes_greater_than_end_time_minutes(self):
     _input = InputValidator("BOOK 10:30 10:15 2")
     self.assertFalse(_input.IsValid)
     self.assertEqual(_input.Query.Reason,
                      "Start Time Minutes greater than End Time Minutes")
 def test_vacancy_no_room_in_buffer_time(self):
     _input = InputValidator("VACANCY 09:00 13:15")
     response = self.makeSpaceService.ExecuteRequest(_input.Query)
     self.assertEqual(response, "NO_VACANT_ROOM")
 def test_unsuccessful_booking_done_in_buffer_time(self):
     _input = InputValidator("BOOK 09:00 13:15 2")
     response = self.bookingService.BookRoom(_input.Query,
                                             self.meetingRooms)
     self.assertEqual(response, "NO_VACANT_ROOM")
 def test_unsuccessful_booking_no_room_with_enough_capacity(self):
     _input = InputValidator("BOOK 09:00 13:15 100")
     response = self.makeSpaceService.ExecuteRequest(_input.Query)
     self.assertEqual(response, "NO_VACANT_ROOM")
 def test_vacancy(self):
     _input = InputValidator("VACANCY 09:30 13:15")
     response = self.makeSpaceService.ExecuteRequest(_input.Query)
     self.assertEqual(response, "C-Cave D-Tower G-Mansion")
Ejemplo n.º 10
0
 def test_invalid_command(self):
     _input = InputValidator("CANCEL 09:30 13:15 2")
     self.assertFalse(_input.IsValid)
     self.assertEqual(_input.Query.Reason, "Not a registered Command")
 def test_unsuccessful_booking_done_in_buffer_time(self):
     _input = InputValidator("BOOK 09:00 13:15 2")
     response = self.makeSpaceService.ExecuteRequest(_input.Query)
     self.assertEqual(response, "NO_VACANT_ROOM")
Ejemplo n.º 12
0
 def test_invalid_input(self):
     _input = InputValidator("BOOK 09:30 09:00 2")
     self.assertFalse(_input.IsValid)
Ejemplo n.º 13
0
 def test_valid_input(self):
     _input = InputValidator("BOOK 09:30 13:15 2")
     self.assertTrue(_input.IsValid)
Ejemplo n.º 14
0
 def test_start_time_hour_greater_than_end_time_hour(self):
     _input = InputValidator("BOOK 10:30 09:30 2")
     self.assertFalse(_input.IsValid)
     self.assertEqual(_input.Query.Reason,
                      "Start Time Hour greater than End Time Hour")
 def test_unsuccessful_booking_no_room_with_enough_capacity(self):
     _input = InputValidator("BOOK 09:00 13:15 100")
     response = self.bookingService.BookRoom(_input.Query,
                                             self.meetingRooms)
     self.assertEqual(response, "NO_VACANT_ROOM")
Ejemplo n.º 16
0
 def test_start_time_and_end_time_equal(self):
     _input = InputValidator("BOOK 09:30 09:30 2")
     self.assertFalse(_input.IsValid)
     self.assertEqual(_input.Query.Reason,
                      "Start Time and End Time is same")
Ejemplo n.º 17
0
 def test_invalid_end_time(self):
     _input = InputValidator("BOOK 09:30 13:16 2")
     self.assertFalse(_input.IsValid)
     self.assertEqual(_input.Query.Reason, "EndTime is not valid")
Ejemplo n.º 18
0
 def test_invalid_start_time(self):
     _input = InputValidator("BOOK 09:01 13:15 2")
     self.assertFalse(_input.IsValid)
     self.assertEqual(_input.Query.Reason, "StartTime is not valid")
 def test_vacancy_no_room_in_buffer_time(self):
     _input = InputValidator("VACANCY 09:00 13:15")
     response = self.vacancyService.GetVacancy(_input.Query,
                                               self.meetingRooms)
     self.assertEqual(response, "NO_VACANT_ROOM")
 def test_vacancy(self):
     _input = InputValidator("VACANCY 09:30 13:15")
     response = self.vacancyService.GetVacancy(_input.Query,
                                               self.meetingRooms)
     self.assertEqual(response, "C-Cave D-Tower G-Mansion")