Esempio n. 1
0
        public void CarStaffAddMethodOk()
        {
            //create an instance of the class we want to create
            clsCarStaffCollection AllCarStaff = new clsCarStaffCollection();
            //create the item of test data
            clsCarStaff TestItem = new clsCarStaff();
            // car to store the rpimary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.StaffNo          = 3;
            TestItem.StaffName        = "Chetan";
            TestItem.StaffAddress     = "80 spence street ";
            TestItem.StaffEmail       = "[email protected] ";
            TestItem.StaffPhoneNumber = "05225889212 ";
            //set thiscar park to the test data
            AllCarStaff.ThisStaff = TestItem;
            //add the record
            PrimaryKey = AllCarStaff.Add();
            // set the primary key of the data
            TestItem.StaffNo = PrimaryKey;
            //find the record
            AllCarStaff.ThisStaff.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllCarStaff.ThisStaff, TestItem);
        }
Esempio n. 2
0
        public void FilterbyFirstNametestDataFound()
        {
            //create an instance of the class we want to create
            clsCarStaffCollection FilterFirstNames = new clsCarStaffCollection();
            //var to store outcome
            Boolean Ok = true;

            //apply a car reg that doesnt exit
            FilterFirstNames.FilterByStaffName("Omer");
            //check that the coorect number of records are found
            if (FilterFirstNames.Count == 2)
            {
                //check that the first record is id 1
                if (FilterFirstNames.StaffList[0].StaffNo != 6)
                {
                    Ok = false;
                }
                //check that the first record  is id 2
                if (FilterFirstNames.StaffList[1].StaffNo != 7)
                {
                    Ok = false;
                }
            }
            else
            {
                Ok = false;
            }
            //test to see that there are no records
            Assert.IsTrue(Ok);
        }
Esempio n. 3
0
        public void InstanceOk()
        {
            //create an instance of the class we want to create
            clsCarStaffCollection AllCarStaff = new clsCarStaffCollection();

            //test to see that it exists
            Assert.IsNotNull(AllCarStaff);
        }
Esempio n. 4
0
        public void FilterByStaffNameNoneFound()
        {
            //create an instance of the filtered data
            clsCarStaffCollection FillteredStaffName = new clsCarStaffCollection();

            //apply a FirstName that doesnt exits
            FillteredStaffName.FilterByStaffName("aaaa");
            //test to see that there are no records found
            Assert.AreEqual(0, FillteredStaffName.Count);
        }
Esempio n. 5
0
        public void FilterBystaffNameMethodOk()
        {
            //create an innstance of the class containing unfiltered results
            clsCarStaffCollection AllCarStaff = new clsCarStaffCollection();
            //create  an instance of the filtered data
            clsCarStaffCollection FilteredStaffName = new clsCarStaffCollection();

            //apply a blank string(should return all records)
            FilteredStaffName.FilterByStaffName("");
            //test to see that the two values are the same
            Assert.AreEqual(AllCarStaff.Count, FilteredStaffName.Count);
        }