public void AddMethod() { //create an instance of a class clsLocationCollection AllLocation = new clsLocationCollection(); //create the item of test data clsLocation TestItem = new clsLocation(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.LocationID = 1; TestItem.PlaneID = 2; TestItem.CountryDeparture = "Bulgaria"; TestItem.CountryDestination = "Africa"; TestItem.AirportDeparture = "Heathrow"; TestItem.AirportDestination = "Gatwick"; //set this location to the test data AllLocation.ThisLocation = TestItem; //add the record PrimaryKey = AllLocation.Add(); //set the primary key of the test data TestItem.LocationID = PrimaryKey; //find the record AllLocation.ThisLocation.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllLocation.ThisLocation, TestItem); }
public void DeleteMethod() { //create an instance of a class clsLocationCollection AllLocation = new clsLocationCollection(); //create the item of test data clsLocation TestItem = new clsLocation(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.LocationID = 1; TestItem.PlaneID = 2; TestItem.CountryDeparture = "Bulgaria"; TestItem.CountryDestination = "Africa"; TestItem.AirportDeparture = "Heathrow"; TestItem.AirportDestination = "Gatwick"; //set this location to the test data AllLocation.ThisLocation = TestItem; //add the record PrimaryKey = AllLocation.Add(); //set the primary key of the test data TestItem.LocationID = PrimaryKey; //find the record AllLocation.ThisLocation.Find(PrimaryKey); //delete the record AllLocation.Delete(); //now find the record Boolean Found = AllLocation.ThisLocation.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void ListAndCount() { //create an instance of a class clsLocationCollection AllLocation = new clsLocationCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsLocation> TestList = new List <clsLocation>(); //add an item to the list //create the item of test data clsLocation TestItem = new clsLocation(); //set its properties TestItem.LocationID = 1; TestItem.PlaneID = 2; TestItem.CountryDeparture = "Bulgaria"; TestItem.CountryDestination = "Africa"; TestItem.AirportDeparture = "Heathrow"; TestItem.AirportDestination = "Gatwick"; //add the item to the test list TestList.Add(TestItem); //assign the data to the property AllLocation.LocationList = TestList; //test to see that the two values are the same Assert.AreEqual(AllLocation.Count, TestList.Count); }
public void InstanceOK() { //create an instance of a class clsLocation ALocation = new clsLocation(); //test to see that it exists Assert.IsNotNull(ALocation); }
//used to test the valid method of the class public void ValidMethod() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create a string variable to store the result of the validation string Error = ""; //create some test data to test the method Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination); //test to see the result is ok. i.e there was no error mssage returned Assert.AreEqual(Error, ""); }
//used to test the Airport Destination property of the class public void AirportDestination() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create some test data to assign to the property string SomeAirportDestination = "Islamabad"; //assign the data to the property ALocation.AirportDestination = SomeAirportDestination; //test to see that the two values are the same Assert.AreEqual(ALocation.AirportDestination, SomeAirportDestination); }
//used to test the Country Destination property of the class public void CountryDestination() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create some test data to assign to the property string SomeCountryDestination = "Dubai"; //assign the data to the property ALocation.CountryDestination = SomeCountryDestination; //test to see that the two values are the same Assert.AreEqual(ALocation.CountryDestination, SomeCountryDestination); }
//used to test the Airport Departure property of the class public void AirportDeparture() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create some test data to assign to the property string SomeAirportDeparture = "Heathrow"; //assign the data to the property ALocation.AirportDeparture = SomeAirportDeparture; //test to see that the two values are the same Assert.AreEqual(ALocation.AirportDeparture, SomeAirportDeparture); }
//used to test the Location ID property of the class public void LocationID() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create some test data to assign to the property Int32 LocationID = 1; //assign the data to the property ALocation.LocationID = LocationID; //test to see that the two values are the same Assert.AreEqual(ALocation.LocationID, LocationID); }
public void AirportDestinationMaxPlusOne() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create a string variable to store the result of the validation string Error = ""; //create some test data to test the method string SomeAirportDestination = "abcndefghijklmnopqrstuvwyzabcdefgdsasdfgh"; //invoke the method Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination); //Test to see that the result is not ok. i.e there should be an error message Assert.AreNotEqual(Error, ""); }
public void CountryDepartureMinLessOne() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create a string variable to store the result of the validation string Error = ""; //create some test data to test the method string SomeCountryDeparture = "Alban"; //invoke the method Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination); //Test to see that the result is not ok. i.e there should be an error message Assert.AreNotEqual(Error, ""); }
//used to test the find method of the class public void FindMethod() { //create an instance of the class clsLocation ALocation = new clsLocation(); //boolean variable to store the result of the validation Boolean Found = false; //create some test data to use with the method Int32 LocationID = 14; //invoke the method Found = ALocation.Find(LocationID); //test to see that the result is correct Assert.IsTrue(Found); }
protected void Page_Load(object sender, EventArgs e) { //create an instance of clsLocation clsLocation ALocation = new clsLocation(); //get the data from the session object ALocation = (clsLocation)Session["ALocation"]; //display the country departure for this entry Response.Write(ALocation.CountryDeparture); //display the country destination for this entry Response.Write(ALocation.AirportDestination); //display the airport departure for this entry Response.Write(ALocation.AirportDeparture); //display the airport destination for this entry Response.Write(ALocation.AirportDestination); }
public void AirportDestinationExtremeMax() { //create an instance of a class clsLocation ALocation = new clsLocation(); //create a string variable to store the result of the validation string Error = ""; //create some test data to test the method string SomeAirportDestination = ""; //pad the string with characters SomeAirportDestination = SomeAirportDestination.PadRight(60, 'a'); //invoke the method Error = ALocation.Valid(SomeCountryDeparture, SomeCountryDestination, SomeAirportDeparture, SomeAirportDestination); //Test to see that the result is not ok. i.e there should be an error message Assert.AreNotEqual(Error, ""); }
private void FillLocation() { clsLocation e = new clsLocation(); clsLocationController ec = new clsLocationController(); DataTable dt = new DataTable(); dt = ec.FetchAllLocation(currentUser.Username, "", ""); if (dt.Rows.Count > 0) { ddlLocation.DataSource = dt; ddlLocation.DataTextField = "Loc_LocationName"; ddlLocation.DataValueField = "Loc_LocationID"; ddlLocation.DataBind(); ddlLocation.Items.Insert(0, new ListItem("-- Select --", "0")); } }
public void ThisLocationProperty() { //create an instance of a class clsLocationCollection AllLocation = new clsLocationCollection(); //create some test data to assign to the property clsLocation TestLocation = new clsLocation(); //set the properties of the test object TestLocation.LocationID = 1; TestLocation.PlaneID = 2; TestLocation.CountryDeparture = "Bulgaria"; TestLocation.CountryDestination = "Africa"; TestLocation.AirportDeparture = "Heathrow"; TestLocation.AirportDestination = "Gatwick"; //assign the data to the property AllLocation.ThisLocation = TestLocation; //test to see that the two values are the same Assert.AreEqual(AllLocation.ThisLocation, TestLocation); }
public void TestPlaneIDFound() { //create an instance of the class clsLocation ALocation = new clsLocation(); //boolean variable to store the result of the search Boolean Found = false; ////boolean variable to record if data is ok Boolean OK = true; //create some test data to use with the method Int32 LocationID = 14; //imvoke the method Found = ALocation.Find(LocationID); //check the plane id if (ALocation.PlaneID != 1) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void UpdateMethod() { //create an instance of a class clsLocationCollection AllLocation = new clsLocationCollection(); //create the item of test data clsLocation TestItem = new clsLocation(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.PlaneID = 2; TestItem.CountryDeparture = "Bulgaria"; TestItem.CountryDestination = "Africa"; TestItem.AirportDeparture = "Heathrow"; TestItem.AirportDestination = "Gatwick"; //set this location to the test data AllLocation.ThisLocation = TestItem; //add the record PrimaryKey = AllLocation.Add(); //set the primary key of the test data TestItem.LocationID = PrimaryKey; //modify the test data TestItem.PlaneID = 3; TestItem.CountryDeparture = "Belgium"; TestItem.CountryDestination = "Zimbabwe"; TestItem.AirportDeparture = "Lahore"; TestItem.AirportDestination = "Heathrow"; //set the record based on the new test data AllLocation.ThisLocation = TestItem; //update the record AllLocation.Update(); //find the record AllLocation.ThisLocation.Find(PrimaryKey); //test to see thislocation matches the test data Assert.AreEqual(AllLocation.ThisLocation, TestItem); }