public void ListAndCountOK() { //create an instance of the class we want to create clsFlightCollection AllFlights = new clsFlightCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsFlights> TestList = new List <clsFlights>(); //add an item to the list //create the item of test data clsFlights TestItem = new clsFlights(); //set its properties TestItem.FlightID = 1; TestItem.FlightNo = "A114"; TestItem.Airline = "Air India"; TestItem.ArrivalAirport = "BHX"; TestItem.Arrival = DateTime.Now.Date; TestItem.Departure = DateTime.Now.Date; TestItem.DepartureAirport = "BHX"; TestItem.Destination = "India"; //add the item to the test list TestList.Add(TestItem); //assign the data to the property AllFlights.FlightList = TestList; //test to see that the two values are the same Assert.AreEqual(AllFlights.Count, TestList.Count); }
public void DeleteMethodOK() { //create an instance of the class we want to create clsFlightCollection AllFlights = new clsFlightCollection(); //create the item of test data clsFlights TestItem = new clsFlights(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.FlightNo = "AA11"; TestItem.Airline = "Air India"; TestItem.ArrivalAirport = "DXB"; TestItem.Arrival = DateTime.Now.Date; TestItem.Departure = DateTime.Now.Date; TestItem.DepartureAirport = "MCR"; TestItem.Destination = "Dubai"; //set ThisFlights to the test data AllFlights.ThisFlight = TestItem; //add the record PrimaryKey = AllFlights.Add(); //set the primary key of the test data TestItem.FlightID = PrimaryKey; //find the record AllFlights.ThisFlight.Find(PrimaryKey); //delete the record AllFlights.Delete(); //now find the record Boolean Found = AllFlights.ThisFlight.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void AddMethodOK() { //create an instance of the class we want to create clsFlightCollection AllFlights = new clsFlightCollection(); //create the item of test data clsFlights TestFlights = new clsFlights(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties //set its properties //TestFlights.FlightID = 1; TestFlights.FlightNo = "AA11"; TestFlights.Airline = "Air India"; TestFlights.ArrivalAirport = "DXB"; TestFlights.Arrival = DateTime.Now.Date; TestFlights.Departure = DateTime.Now.Date; TestFlights.DepartureAirport = "MCR"; TestFlights.Destination = "Dubai"; //set ThisFlights to the test data AllFlights.ThisFlight = TestFlights; //add the record PrimaryKey = AllFlights.Add(); //set the primary key of the test data TestFlights.FlightID = PrimaryKey; //find the record AllFlights.ThisFlight.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllFlights.ThisFlight, TestFlights); }
public void InstanceOK() { //create a new instance of the class we want to create clsFlights AnFlight = new clsFlights(); //test to see if it exists Assert.IsNotNull(AnFlight); }
public void DepartureOK() { //create a new instance of the class we want to create clsFlights AFlight = new clsFlights(); //create some test data DateTime DepartureDate = DateTime.Now.Date; AFlight.DepartureDate = DepartureDate; //test to see if it exists Assert.AreEqual(AFlight.DepartureDate, DepartureDate); }
public void ArrivalOK() { //create a new instance of the class we want to create clsFlights AFlight = new clsFlights(); //create some test data DateTime ArrivalDate = DateTime.Now.Date; AFlight.ArrivalDate = ArrivalDate; //test to see if it exists Assert.AreEqual(AFlight.ArrivalDate, ArrivalDate); }
public void AirlineID() { //create instance of class we want to create clsFlights AnFlight = new clsFlights(); //create some test data to assign to the property string TestData = "Air India"; //assign the data to the property AnFlight.Airline = TestData; //test to see that the two values are the same Assert.AreEqual(AnFlight.Airline, TestData); }
public void FlightNoOK() { //create instance of class we want to create clsFlights AnFlight = new clsFlights(); //create some test data to assign to the property string TestData = "AI 114"; //assign the data to the property AnFlight.FlightNo = TestData; //test to see that the two values are the same Assert.AreEqual(AnFlight.FlightNo, TestData); }
public void FlightNoMinMinus1() { //create an instance of new class we want to create clsFlights AFlight = new clsFlights(); //string variable to store the results of the validation string OK = ""; //create some test data to assign to property string FlightNo = ""; string Airline = "Air India"; string ArrivalAirport = "Dubai Airport"; string Arrival = DateTime.Now.Date.ToString(); string Departure = DateTime.Now.Date.ToString(); string DepartureAirport = "Birmingham Airport"; string Destination = "Dubai"; //Boolean Active = true; //invoke method OK = AFlight.Valid(FlightNo, Airline, Destination, Arrival, ArrivalAirport, Departure, DepartureAirport); //test to see if it exists Assert.AreNotEqual(OK, ""); }
public void ThisFlightsPropertyOK() { //create an instance of the class we want to create clsFlightCollection AllFlights = new clsFlightCollection(); //create some test data to assign to the property clsFlights TestFlights = new clsFlights(); //set the properties of the test object TestFlights.FlightID = 1; TestFlights.FlightNo = "A114"; TestFlights.Airline = "Air India"; TestFlights.ArrivalAirport = "BHX"; TestFlights.Arrival = DateTime.Now.Date; TestFlights.Departure = DateTime.Now.Date; TestFlights.DepartureAirport = "BHX"; TestFlights.Destination = "India"; //assign the data to the property AllFlights.ThisFlight = TestFlights; //test to see that the two values are the same Assert.AreEqual(AllFlights.ThisFlight, TestFlights); }
public void UpdateMethodOK() { //create an instance of the class we want to create clsFlightCollection AllFlights = new clsFlightCollection(); //create the item of test data clsFlights TestItem = new clsFlights(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.FlightNo = "AA11"; TestItem.Airline = "Air India"; TestItem.ArrivalAirport = "DXB"; TestItem.Arrival = DateTime.Now.Date; TestItem.Departure = DateTime.Now.Date; TestItem.DepartureAirport = "MCR"; TestItem.Destination = "Dubai"; //set ThisFlights to the test data AllFlights.ThisFlight = TestItem; //add the record PrimaryKey = AllFlights.Add(); //set the primary key of the test data TestItem.FlightID = PrimaryKey; //modify the test data TestItem.FlightNo = "AA30"; TestItem.Airline = "Air France"; TestItem.ArrivalAirport = "LHR"; TestItem.Arrival = DateTime.Now.Date; TestItem.Departure = DateTime.Now.Date; TestItem.DepartureAirport = "DHL"; TestItem.Destination = "Germany"; //set the record based on the new test data AllFlights.ThisFlight = TestItem; //update the record AllFlights.Update(); //find the record AllFlights.ThisFlight.Find(PrimaryKey); //test to see ThisFlights matches the test data Assert.AreEqual(AllFlights.ThisFlight, TestItem); }