public void UpdateMethod()
        {
            //create an instance of a class
            clsPlaneCollection AllPlane = new clsPlaneCollection();
            //create the item of test data
            clsPlane TestItem = new clsPlane();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.LocationID = 2;
            TestItem.PlaneName  = "Emirates";
            TestItem.HoursFly   = 12;
            //set thisplane to the test data
            AllPlane.ThisPlane = TestItem;
            //add the record
            PrimaryKey = AllPlane.Add();
            //set the primary key of the test data
            TestItem.PlaneID = PrimaryKey;
            //modify the test data
            TestItem.LocationID = 3;
            TestItem.PlaneName  = "FlyDubai";
            TestItem.HoursFly   = 2;
            //set the record based on the new test data
            AllPlane.ThisPlane = TestItem;
            //update the record
            AllPlane.Update();
            //find the record
            AllPlane.ThisPlane.Find(PrimaryKey);
            //test to see thisplane matches the test data
            Assert.AreEqual(AllPlane.ThisPlane, TestItem);
        }
        public void AddMethod()
        {
            //create an instance of a class
            clsPlaneCollection AllPlane = new clsPlaneCollection();
            //create the item of test data
            clsPlane TestItem = new clsPlane();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.PlaneID    = 1;
            TestItem.LocationID = 2;
            TestItem.PlaneName  = "Emirates";
            TestItem.HoursFly   = 12;
            //set thisplane to the test data
            AllPlane.ThisPlane = TestItem;
            //add the record
            PrimaryKey = AllPlane.Add();
            //set the primary key of the test data
            TestItem.PlaneID = PrimaryKey;
            //find the record
            AllPlane.ThisPlane.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllPlane.ThisPlane, TestItem);
        }
        public void DeleteMethod()
        {
            //create an instance of a class
            clsPlaneCollection AllPlane = new clsPlaneCollection();
            //create the item of test data
            clsPlane TestItem = new clsPlane();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.PlaneID    = 1;
            TestItem.LocationID = 2;
            TestItem.PlaneName  = "Emirates";
            TestItem.HoursFly   = 12;
            //set thisplane to the test data
            AllPlane.ThisPlane = TestItem;
            //add the record
            PrimaryKey = AllPlane.Add();
            //set the primary key of the test data
            TestItem.PlaneID = PrimaryKey;
            //find the record
            AllPlane.ThisPlane.Find(PrimaryKey);
            //delete the record
            AllPlane.Delete();
            //now find the record
            Boolean Found = AllPlane.ThisPlane.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
示例#4
0
        public void InstanceOK()
        {
            //create an instance of a class
            clsPlane APlane = new clsPlane();

            //test to see that it exists
            Assert.IsNotNull(APlane);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //create a new instance of clsPlane
        clsPlane APlane = new clsPlane();

        //get the data from the session object
        APlane = (clsPlane)Session["APlane"];
        //display the plane name for this entry
        Response.Write(APlane.PlaneName);
        //display the hours fly for this entry
        Response.Write(APlane.HoursFly);
    }
示例#6
0
        //used to test the valid method of the class
        public void ValidMethod()
        {
            //create an instance of a class
            clsPlane APlane = new clsPlane();
            //create a string variable to store the result of the validation
            string Error = "";

            //create some test data to test the method
            Error = APlane.Valid(SomePlaneName, SomeHoursFly);
            //test to see the result is ok. i.e there was no error mssage returned
            Assert.AreEqual(Error, "");
        }
示例#7
0
        //used to test the LocationID property of the class
        public void LocationID()
        {
            //create an instance of a class
            clsPlane APlane = new clsPlane();
            //create some test data to assign to the property
            Int32 LocationID = 2;

            //assign the data to the property
            APlane.LocationID = LocationID;
            //test to see that the two values are the same
            Assert.AreEqual(APlane.LocationID, LocationID);
        }
示例#8
0
        //used to test the HoursFly property of the class
        public void HoursFly()
        {
            //create an instance of a class
            clsPlane APlane = new clsPlane();
            //create some test data to assign to the property
            Int32 SomeHoursFly = 12;

            //assign the data to the property
            APlane.HoursFly = SomeHoursFly;
            //test to see that the two values are the same
            Assert.AreEqual(APlane.HoursFly, SomeHoursFly);
        }
示例#9
0
        //used to test the Plane name property of the class
        public void PlaneName()
        {
            //create an instance of a class
            clsPlane APlane = new clsPlane();
            //create some test data to assign to the property
            string SomePlaneName = "Emirates";

            //assign the data to the property
            APlane.PlaneName = SomePlaneName;
            //test to see that the two values are the same
            Assert.AreEqual(APlane.PlaneName, SomePlaneName);
        }
        //used to test the find method of the class
        public void FindMethod()
        {
            //create an instance of the class
            clsPlane APlane = new clsPlane();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 PlaneID = 15;

            //invoke the method
            Found = APlane.Find(PlaneID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
示例#11
0
        public void HoursFlyMaxPlusOne()
        {
            //create an instance of a class
            clsPlane APlane = new clsPlane();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string SomeHoursFly = "12345";

            //invoke the method
            Error = APlane.Valid(SomePlaneName, SomeHoursFly);
            //Test to see that the result is not ok. i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
示例#12
0
        public void HoursFlyExtremeMax()
        {
            //create an instance of a class
            clsPlane APlane = new clsPlane();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string SomeHoursFly = "";

            //pad the string with characters
            SomeHoursFly = SomePlaneName.PadRight(10, 'a');
            //invoke the method
            Error = APlane.Valid(SomeHoursFly, SomeHoursFly);
            //Test to see that the result is not ok. i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
        public void ThisPlaneProperty()
        {
            //create an instance of a class
            clsPlaneCollection AllPlane = new clsPlaneCollection();
            //create some test data to assign to the property
            clsPlane TestPlane = new clsPlane();

            //set the properties of the test object
            TestPlane.PlaneID    = 1;
            TestPlane.LocationID = 2;
            TestPlane.PlaneName  = "Emirates";
            TestPlane.HoursFly   = 12;
            //assign the data to the property
            AllPlane.ThisPlane = TestPlane;
            //test to see that the two values are the same
            Assert.AreEqual(AllPlane.ThisPlane, TestPlane);
        }
        public void TestLocationIDFound()
        {
            //create an instance of the class
            clsPlane APlane = new clsPlane();
            //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 PlaneID = 15;

            //imvoke the method
            Found = APlane.Find(PlaneID);
            //check the booking id
            if (APlane.LocationID != 2)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void ListAndCount()
        {
            //create an instance of a class
            clsPlaneCollection AllPlane = new clsPlaneCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of objects
            List <clsPlane> TestList = new List <clsPlane>();
            //add an item to the list
            //create the item of test data
            clsPlane TestItem = new clsPlane();

            //set its properties
            TestItem.PlaneID    = 1;
            TestItem.LocationID = 2;
            TestItem.PlaneName  = "Emirates";
            TestItem.HoursFly   = 12;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllPlane.PlaneList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllPlane.Count, TestList.Count);
        }