public void TEST_ChecksIfDBIsEmpty() { //Arrange, Act int result = Flight.GetAll().Count; Assert.Equal(0, result); }
public void Test_DatabaseEmptyAtFirst() { //Arrange,Act int result = Flight.GetAll().Count; //Assert Assert.Equal(0, result); }
public static Dictionary <string, object> ModelMaker() { Dictionary <string, object> model = new Dictionary <string, object> { }; model.Add("Flights", Flight.GetAll()); model.Add("Cities", City.GetAll()); return(model); }
public void Test_Save_CheckFlightSaveToDB() { List <Flight> totalFlights = new List <Flight> { }; Flight tempFlight = new Flight("complete", "5 am", "seattle", "los angeles"); totalFlights.Add(tempFlight); tempFlight.Save(); Assert.Equal(totalFlights, Flight.GetAll()); }
public void Test_Delete() { Flight newFlight = new Flight("1", "On time", "6:30 PM"); newFlight.Save(); List <Flight> expected = new List <Flight> { }; newFlight.Delete(); List <Flight> actual = Flight.GetAll(); Assert.Equal(expected, actual); }
public void Test_Save_AssignedIdtoFlight() { //Arrange DateTime departureTime = new DateTime(2017, 3, 14, 9, 30, 0); string flightStatus = "On Time"; Flight testFlight = new Flight("AX5390", departureTime, flightStatus); testFlight.Save(); Flight savedFlight = Flight.GetAll()[0]; //Act int savedId = savedFlight.GetId(); int testId = testFlight.GetId(); //Assert Assert.Equal(testId, savedId); }
public void Test_Save_SavesToDatabase() { //Arrange DateTime departureTime = new DateTime(2017, 3, 14, 9, 30, 0); string flightStatus = "On Time"; Flight testFlight = new Flight("AX5390", departureTime, flightStatus); testFlight.Save(); //Act List <Flight> resultList = Flight.GetAll(); List <Flight> testList = new List <Flight> { testFlight }; //Assert Assert.Equal(testList, resultList); }
public void Test_DeleteThisFlight_OneFlightDeletedFromDatabase() {//Arrange DateTime departureTime = new DateTime(2017, 3, 14, 9, 30, 0); string flightStatus = "On Time"; Flight firstFlight = new Flight("AX5390", departureTime, flightStatus); Flight secondFlight = new Flight("BD890", departureTime, flightStatus); firstFlight.Save(); secondFlight.Save(); //Act firstFlight.DeleteThisFlight(); List <Flight> result = Flight.GetAll(); List <Flight> verify = new List <Flight> { secondFlight }; //Assert Assert.Equal(verify, result); }
public void Test_GetAll_ReturnsListofFlights() { //Arrange DateTime firstDepartureTime = new DateTime(2017, 3, 14, 9, 30, 0); DateTime secondDepartureTime = new DateTime(2007, 3, 14, 9, 30, 0); string flightStatus = "On Time"; Flight firstFlight = new Flight("AX5390", firstDepartureTime, flightStatus); Flight secondFlight = new Flight("B45390", secondDepartureTime, flightStatus); //Act firstFlight.Save(); secondFlight.Save(); //Assert List <Flight> actualResult = Flight.GetAll(); List <Flight> expectedResult = new List <Flight> { secondFlight, firstFlight }; Assert.Equal(expectedResult, actualResult); }
public void Test_IfEmpty() { int result = Flight.GetAll().Count; Assert.Equal(0, result); }