public void TestSolve_AdditionalSanta() { var input = TestDataset1.Create(); var solver = new GoogleRoutingSolver(input, new GoogleRoutingConfig(3, SolvingMode.Default)); var actual = solver.Solve(10, null, null); CheckValid(actual); CheckAllVisited(actual); CheckNoWrongBreaks(actual); CheckNoAdditionalSantas(actual); }
public void Create_MultipleSeats_ShouldPass() { //Arrange var seatReservationDataContext = new InMemorySeatReservationDataContext("SeatAddMultiple"); var testDB = new TestDataset1(); testDB.Load(seatReservationDataContext); var testData = GetDataset2(); //Act var seatAdd = new SeatAdd(seatReservationDataContext).Create(2, testData); //Assert Assert.True(seatAdd.Count == 4); }
public void Remove_Seat_ShouldNotDelete() { //Arrange var seatReservationDataContext = new InMemorySeatReservationDataContext("SeatRemoveNot"); var testDB = new TestDataset1(); testDB.Load(seatReservationDataContext); var testData = "ABC"; //Act var seatAdd = new SeatRemove(seatReservationDataContext).Remove(testData); //Assert Assert.Equal(0, seatAdd); }
public void Remove_Seat_ShouldPass() { //Arrange var seatReservationDataContext = new InMemorySeatReservationDataContext("SeatRemove"); var testDB = new TestDataset1(); testDB.Load(seatReservationDataContext); var testData = "101010"; //Act var seatAdd = new SeatRemove(seatReservationDataContext).Remove(testData); //Assert Assert.True(seatAdd > 0); }
public void EventList_ListEvents_ShouldReturnMarch() { //Arrange var seatReservationDataContext = new InMemorySeatReservationDataContext("EventList_ListEvents"); var testDB = new TestDataset1(); testDB.Load(seatReservationDataContext); //Act var items = new EventList(seatReservationDataContext).List(); //Assert Assert.Single(items); Assert.Equal("March Dev Meeting", items[0].Name); Assert.Equal("Room1", items[0].RoomName); }
public void List_CheckStatus_ReturnSeat(int row, int column, int allocationTypeId, string allocationTypeDescription) { //Arrange var seatReservationDataContext = new InMemorySeatReservationDataContext($"SeatList{row}{column}"); var testDB = new TestDataset1(); testDB.Load(seatReservationDataContext); //Act var eventList = new SeatList(seatReservationDataContext).List(2); var item = eventList.Where(p => p.Row == row && p.Column == column).FirstOrDefault(); //Assert Assert.NotNull(item); Assert.Equal(item.AllocationTypeId, allocationTypeId); Assert.Equal(item.AllocationTypeDescription, allocationTypeDescription); }
public void Create_Seat_ValidationShouldFail(string name, string email, string expected) { //Arrange var seatReservationDataContext = new InMemorySeatReservationDataContext($"SeatAddValidation{name.Substring(0,3)}"); var testDB = new TestDataset1(); testDB.Load(seatReservationDataContext); var testData = new List <SeatAddItemDTO> { new SeatAddItemDTO { SeatId = 16, PersonName = name, Email = email } }; //Act Exception ex = Assert.Throws <ValidationException>(() => new SeatAdd(seatReservationDataContext).Create(2, testData)); //Assert Assert.Contains(expected, ex.Message); }
public void Create_Seat_ShouldPass() { //Arrange var seatReservationDataContext = new InMemorySeatReservationDataContext("SeatAdd"); var testDB = new TestDataset1(); testDB.Load(seatReservationDataContext); var testData = GetDataset1(); //Act var seatAdd = new SeatAdd(seatReservationDataContext).Create(2, testData); //Assert Assert.Single(seatAdd); Assert.True(seatAdd[0] > 0); var item = seatReservationDataContext.EventSeats .Where(p => p.EventSeatId == seatAdd[0]) .FirstOrDefault(); Assert.True(item.Identifier.Length > 0); }