Beispiel #1
0
        public void DeleteMethodOK()
        {
            clsStaffCollection AllStaffs = new clsStaffCollection();

            Class_Library.clsStaff TestItem = new Class_Library.clsStaff();
            Int32 PrimaryKey = 0;


            TestItem.StaffFirstName = "Kim";
            TestItem.StaffLastName  = "Amir";
            TestItem.ContactNumber  = "07876547";
            TestItem.NINumber       = "987654456.";
            TestItem.TaxCode        = "P65.";
            TestItem.DateStarted    = DateTime.Now.Date;
            TestItem.DateEnded      = DateTime.Now.Date;
            TestItem.Salary         = Convert.ToDecimal("1266.00");
            TestItem.Shift          = true;;

            AllStaffs.ThisStaff = TestItem;
            PrimaryKey          = AllStaffs.Add();
            TestItem.StaffNo    = PrimaryKey;
            AllStaffs.ThisStaff.Find(PrimaryKey);
            AllStaffs.Delete();
            Boolean Found = AllStaffs.ThisStaff.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
Beispiel #2
0
        //public constructor for the class
        public clsStaffCollection()
        {
            //create an instance of the staff class to store a staff member
            clsStaff AStaff = new clsStaff();

            //set the Last name to Peters
            AStaff.LastName = "Peters";
            //add the name to the private list of staff
            mAllStaff.Add(AStaff);
            //re initialise the AStaff object to accept a new item
            AStaff = new clsStaff();
            //set the name to Keter
            AStaff.LastName = "Keter";
            //add the second name to the private list of staff
            mAllStaff.Add(AStaff);
            //the private list now contains two members
        }
Beispiel #3
0
        public void ThisStaffPropertyOK()
        {
            clsStaffCollection AllStaffs = new clsStaffCollection();

            Class_Library.clsStaff TestStaff = new Class_Library.clsStaff();

            TestStaff.StaffFirstName = "Kim";
            TestStaff.StaffLastName  = "Amir";
            TestStaff.ContactNumber  = "07876547";
            TestStaff.NINumber       = "987654456.";
            TestStaff.TaxCode        = "P65.";
            TestStaff.DateStarted    = DateTime.Now.Date;
            TestStaff.DateEnded      = DateTime.Now.Date;
            TestStaff.Salary         = Convert.ToDecimal("1266.00");
            TestStaff.Shift          = true;

            AllStaffs.ThisStaff = TestStaff;
            Assert.AreEqual(AllStaffs.ThisStaff, TestStaff);
        }
Beispiel #4
0
        public void ListAndCountOK()
        {
            clsStaffCollection            AllStaffs = new clsStaffCollection();
            List <Class_Library.clsStaff> TestList  = new List <Class_Library.clsStaff>();

            Class_Library.clsStaff TestItem = new Class_Library.clsStaff();


            TestItem.StaffFirstName = "Kim";
            TestItem.StaffLastName  = "Amir";
            TestItem.ContactNumber  = "07876547";
            TestItem.NINumber       = "987654456.";
            TestItem.TaxCode        = "P65.";
            TestItem.DateStarted    = DateTime.Now.Date;
            TestItem.DateEnded      = DateTime.Now.Date;
            TestItem.Salary         = Convert.ToDecimal("1266.00");
            TestItem.Shift          = true;

            TestList.Add(TestItem);
            AllStaffs.StaffList = TestList;
            Assert.AreEqual(AllStaffs.Count, TestList.Count);
        }