예제 #1
0
        public void ThisStaffPropertyOK()
        {
            //create an instance of the class we wantto create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create some tests data to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set the properties of the tests object
            TestStaff.StaffNo   = 1;
            TestStaff.FirstName = "Ashley";
            TestStaff.LastName  = "Redman";
            TestStaff.Email     = "*****@*****.**";
            TestStaff.Position  = "Manager";
            TestStaff.TeleNo    = "01509263756";
            //Assign the data to the property
            AllStaff.ThisStaff = TestStaff;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
예제 #2
0
        public void ThisRecordPropertyOK()
        {
            //instance of a staff collection class is created
            clsStaffCollection AllRecords = new clsStaffCollection();
            //create some test data to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set the properties of the test object
            TestStaff.StaffID     = 1;
            TestStaff.FullName    = "Rookaya Dokrat";
            TestStaff.StaffPwd    = "default!";
            TestStaff.DateOfBirth = Convert.ToDateTime("15/12/1998");
            TestStaff.Salary      = 9.50M;
            TestStaff.FullTime    = false;
            //Assign the data to the property
            AllRecords.ThisRecord = TestStaff;
            //test to see that the two values are the same
            Assert.AreEqual(AllRecords.ThisRecord, TestStaff);
        }
예제 #3
0
        public void ThisStaffMemberOK()
        {
            //create an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create some tesst data to assign to staff
            clsStaff TestStaffMember = new clsStaff();

            //set the properties of test object
            TestStaffMember.Employer          = true;
            TestStaffMember.StaffDOB          = DateTime.Parse("23/03/1999");
            TestStaffMember.StaffEmailAddress = "*****@*****.**";
            TestStaffMember.StaffID           = 1;
            TestStaffMember.StaffSalary       = 30000;
            TestStaffMember.StaffName         = "Name";
            //assign the data to the property
            AllStaff.ThisStaff = TestStaffMember;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestStaffMember);
        }
예제 #4
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        clsStaff AStaff    = new clsStaff();
        string   Name      = txtName.Text;
        string   Email     = txtEmail.Text;
        string   Hire_Date = txtHireDate.Text;
        bool     Active    = checkActive.Checked;
        string   Salary    = txtSalary.Text;
        string   Error     = "";

        Error = AStaff.Valid(Name, Email, Hire_Date, Salary);

        if (Error == "")

        {
            AStaff.staff_id  = staff_id;
            AStaff.Name      = Name;
            AStaff.Email     = Email;
            AStaff.Hire_Date = Convert.ToDateTime(Hire_Date);
            AStaff.Active    = checkActive.Checked;
            AStaff.Salary    = Convert.ToDouble(Salary);
            clsStaffCollection StaffList = new clsStaffCollection();

            if (staff_id == -1)
            {
                StaffList.ThisStaff = AStaff;
                StaffList.Add();
            }
            else
            {
                StaffList.ThisStaff.Find(staff_id);
                StaffList.ThisStaff = AStaff;
                StaffList.Update();
            }

            Response.Redirect("StaffList.aspx");
        }
        else

        {
            lblError.Text = Error;
        }
    }
예제 #5
0
        public void ThisStaffPropertyOK()
        {
            //cretae an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create some test dat to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set its properties of the test object
            TestStaff.StaffId          = 1;
            TestStaff.StaffFirstName   = "John";
            TestStaff.StaffLastName    = "Smith";
            TestStaff.StaffEmail       = "*****@*****.**";
            TestStaff.StaffTelephone   = 01163480420;
            TestStaff.StaffDateOfBirth = DateTime.Now.Date;
            //assign the data to the property
            AllStaff.ThisStaff = TestStaff;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
예제 #6
0
        public void ThisStaffPropertyOK()
        {
            //create the instance of the class we want to create
            clsStaffCollection AllStaffs = new clsStaffCollection();
            //create some test data to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set the properties of the test object
            TestStaff.StaffId    = 1;
            TestStaff.Name       = "Syed";
            TestStaff.Phonenum   = "123456789123456";
            TestStaff.Salary     = 19999.99m;
            TestStaff.DateJoined = DateTime.Now.Date;
            TestStaff.Active     = true;
            //assign the data to the property
            AllStaffs.ThisStaff = TestStaff;
            //test to see that the two values are the same;
            Assert.AreEqual(AllStaffs.ThisStaff, TestStaff);
        }
예제 #7
0
        public void ThisStaffPropertyOK()
        {
            clsStaffCollection AllStaff = new clsStaffCollection();

            clsStaff TestStaff = new clsStaff();

            TestStaff.Availability = true;
            TestStaff.DateofBirth  = Convert.ToDateTime("15/01/2001");
            TestStaff.Name         = "Filip";
            TestStaff.Surname      = "Kobeszko";
            TestStaff.PhoneNumber  = "07387666666";
            TestStaff.StaffID      = 1;

            AllStaff.ThisStaff = TestStaff;



            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
예제 #8
0
        public void ThisStaffPropertyOkay()
        {
            //Create an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create some test data to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set the properties to test the object
            TestStaff.StaffExists = true;
            TestStaff.Name        = "Test Name";
            TestStaff.DateStarted = DateTime.Now.Date;
            TestStaff.JobRole     = "Test Job Role";
            TestStaff.Email       = "Test Email";
            TestStaff.StaffId     = 6;
            //assign the data to the property
            AllStaff.ThisStaff = TestStaff;
            //Test to see if the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
예제 #9
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        //create a new instance of clsStaff
        clsStaff StaffMember = new clsStaff();

        string FirstName    = txtFirstName.Text;
        string LastName     = txtLastName.Text;
        string EmailAddress = txtEmailAddress.Text;
        string HomeAddress  = txtHomeAddress.Text;
        string StartDate    = txtStartDate.Text;
        string Error        = "";

        Error = StaffMember.Valid(FirstName, LastName, EmailAddress, HomeAddress, StartDate);
        if (Error == "")
        {
            StaffMember.StaffId      = StaffId;
            StaffMember.FirstName    = FirstName;
            StaffMember.LastName     = LastName;
            StaffMember.EmailAddress = EmailAddress;
            StaffMember.HomeAddress  = HomeAddress;
            StaffMember.StartDate    = Convert.ToDateTime(StartDate);
            StaffMember.IsWorking    = chkIsWorking.Checked;
            clsStaffCollection StaffList = new clsStaffCollection();

            if (StaffId == -1)
            {
                StaffList.ThisStaffMember = StaffMember;
                StaffList.Add();
            }
            else
            {
                StaffList.ThisStaffMember.Find(StaffId);
                StaffList.ThisStaffMember = StaffMember;
                StaffList.Update();
            }

            Response.Redirect("StaffList.aspx");
        }
        else
        {
            lblError.Text = Error;
        }
    }
예제 #10
0
        public void ReportByNameTestDataFoundOK()
        {
            clsStaffCollection FilteredStaff = new clsStaffCollection();
            Boolean            OK            = true;

            FilteredStaff.ReportByName("James Smith");
            if (FilteredStaff.Count == 1)
            {
                if (FilteredStaff.StaffList[0].ID != 1)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
예제 #11
0
        public void StaffListOK()
        {
            clsStaffCollection AllStaff = new clsStaffCollection();
            List <clsStaff>    TestList = new List <clsStaff>();

            clsStaff TestItem = new clsStaff();

            TestItem.StaffId      = 101;
            TestItem.FirstName    = "Joe";
            TestItem.LastName     = "Bennet";
            TestItem.EmailAddress = "*****@*****.**";
            TestItem.HomeAddress  = "101 Joe Ln, LE1 101";
            TestItem.StartDate    = DateTime.Now.Date;
            TestItem.IsWorking    = true;

            TestList.Add(TestItem);
            AllStaff.StaffList = TestList;
            Assert.AreEqual(AllStaff.StaffList, TestList);
        }
        public void ListAndCountOk()
        {
            clsStaffCollection AllStaff  = new clsStaffCollection();
            List <clsStaff>    TestList  = new List <clsStaff>();
            clsStaff           TestStaff = new clsStaff();

            TestStaff.staff_id  = 1;
            TestStaff.Name      = "Steve,Harris";
            TestStaff.Email     = "*****@*****.**";
            TestStaff.Hire_Date = DateTime.Now.Date;
            TestStaff.Salary    = 7000.00;
            TestStaff.Active    = true;

            TestList.Add(TestStaff);

            AllStaff.StaffList = TestList;

            Assert.AreEqual(AllStaff.Count, TestList.Count);
        }
예제 #13
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);
        }
예제 #14
0
        public void UpdateMethodOk()
        {
            // create an instance of the class we want to create
            clsStaffCollection AllMembers = new clsStaffCollection();
            // create the item of test data
            clsStaff TestItem = new clsStaff();
            // primary key variable
            Int32 PrimaryKey = 0;

            // set its properties
            TestItem.StaffFirstName    = "Matthew";
            TestItem.StaffLastName     = "Anderson";
            TestItem.StaffAddress      = "85 Warstead Road";
            TestItem.StaffContactNo    = "01922645322";
            TestItem.StaffDOB          = DateTime.Now.AddYears(-61);
            TestItem.StaffDateJoined   = DateTime.Now.Date;
            TestItem.StaffPostCode     = "WS29RA";
            TestItem.StaffEmailAddress = "*****@*****.**";
            // set ThisDestination to the test data
            AllMembers.ThisMember = TestItem;
            // add the record
            PrimaryKey = AllMembers.Add();
            // set the primary key of the test data
            TestItem.StaffID = PrimaryKey;
            // modify the test data
            TestItem.StaffFirstName    = "Andy";
            TestItem.StaffLastName     = "Garcia";
            TestItem.StaffAddress      = "92 Dickensian Road";
            TestItem.StaffContactNo    = "01922458322";
            TestItem.StaffDOB          = DateTime.Now.AddYears(-20);
            TestItem.StaffDateJoined   = DateTime.Now.Date;
            TestItem.StaffPostCode     = "LE1 TG2";
            TestItem.StaffEmailAddress = "*****@*****.**";
            // set the record based on the new test data
            AllMembers.ThisMember = TestItem;
            // update the record
            AllMembers.Update();
            // find the record
            AllMembers.ThisMember.Find(PrimaryKey);
            // test to see ThisDestination matches the test data
            Assert.AreEqual(AllMembers.ThisMember, TestItem);
        }
예제 #15
0
    // function for display staff
    Int32 DisplayStaff(string LastNameFilter)
    {
        // create an instance of the class
        clsStaffCollection MyStaffBook = new clsStaffCollection();
        // var to store the Record count
        Int32 RecordCount;
        // var to store the first name
        string FirstName;
        // var to store the last name
        string LastName;
        // var to store the post code
        string PostCode;
        // var to store the staff no
        string StaffNo;
        // initialise the index at 0
        Int32 Index = 0;

        // clear the list
        lstStaff.Items.Clear();
        // filter the staff list by the last name methor
        MyStaffBook.ReportByLastName(LastNameFilter);
        // get the count of records
        RecordCount = MyStaffBook.Count;
        // while index is less than record count
        while (Index < RecordCount)
        {
            // store the staff name
            FirstName = Convert.ToString(MyStaffBook.StaffList[Index].StaffFirstName);
            LastName  = Convert.ToString(MyStaffBook.StaffList[Index].StaffLastName);
            PostCode  = Convert.ToString(MyStaffBook.StaffList[Index].PostCode);
            StaffNo   = Convert.ToString(MyStaffBook.StaffList[Index].StaffNo);

            // set up a new object of the class list item
            ListItem NewItem = new ListItem(LastName + " " + " " + PostCode, StaffNo);
            // add the new item to the list
            lstStaff.Items.Add(NewItem);
            // increment the index
            Index++;
        }
        // return the number of records
        return(RecordCount);
    }
예제 #16
0
        public void UpdateMethod()
        {
            //Create the instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create the item of the test data
            clsStaff TestItem = new clsStaff();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Admin         = false;
            TestItem.StaffID       = 11312;
            TestItem.StaffPosition = "Admin";
            TestItem.Salary        = 1000.00;
            TestItem.FirstName     = "Nelson";
            TestItem.DateOfBirth   = "07/09/2002";
            TestItem.StartDate     = "21/04/2021";
            //set ThisStaff to the test data
            AllStaff.ThisStaff = TestItem;
            //Add the record
            PrimaryKey = AllStaff.Add();
            //Set primary key of the test data
            TestItem.StaffID = PrimaryKey;
            //Find the record
            AllStaff.ThisStaff.Find(PrimaryKey);
            //set its properties
            TestItem.Admin         = false;
            TestItem.StaffID       = 11312;
            TestItem.StaffPosition = "Admin";
            TestItem.Salary        = 1000.00;
            TestItem.FirstName     = "Nelson";
            TestItem.DateOfBirth   = "07/09/2002";
            TestItem.StartDate     = "21/04/2021";
            //set the record based on the new data
            AllStaff.ThisStaff = TestItem;
            //Update the record
            AllStaff.Update();
            //Find the record
            AllStaff.ThisStaff.Find(PrimaryKey);
            //Test to see the two values are the same
            Assert.areEqual(AllStaff.ThisStaff, TestItem);
        }
예제 #17
0
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create the item of test data
            clsStaff TestItem = new clsStaff();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.Active         = true;
            TestItem.StaffNo        = 1;
            TestItem.CountyNo       = 1;
            TestItem.StaffFirstName = "Sally";
            TestItem.StaffLastName  = "Gomery";
            TestItem.AddressLine    = "8 Hillbilly State";
            TestItem.PostCode       = "HG6 8SH";
            TestItem.PhoneNo        = "07563856402";
            //set ThisAddress to the test data
            AllStaff.ThisStaff = TestItem;
            //add the record
            PrimaryKey = AllStaff.Add();
            //set the primary key of the test data
            TestItem.StaffNo = PrimaryKey;
            // modify the test data
            TestItem.Active         = false;
            TestItem.StaffNo        = 5;
            TestItem.CountyNo       = 5;
            TestItem.StaffFirstName = "Shade";
            TestItem.StaffLastName  = "Fishers";
            TestItem.AddressLine    = "7 Luther Day ";
            TestItem.PostCode       = "7G9 LEO";
            TestItem.PhoneNo        = "07563856409";
            // set the record based on the new test data
            AllStaff.ThisStaff = TestItem;
            // update the record
            AllStaff.Update();
            //find the record
            AllStaff.ThisStaff.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestItem);
        }
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsStaffCollection AllStaffs = new clsStaffCollection();
            //create the item of test data
            clsStaff TestItem = new clsStaff();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its prperties
            TestItem.StaffNumber = "P1622604";
            TestItem.FirstName   = "Zihao";
            TestItem.LastName    = "Zhang";
            TestItem.Gender      = "Male";
            TestItem.Position    = "Cleaner";
            TestItem.Password    = "******";
            TestItem.Attendence  = 98.6;
            TestItem.Address     = "Leicester";
            TestItem.PhoneNumber = "+12345678";
            //set ThisStaff  to the test data
            AllStaffs.ThisStaff = TestItem;
            //add the record
            PrimaryKey = AllStaffs.Add();
            //modify the test data
            TestItem.StaffNumber = "P1622605";
            TestItem.FirstName   = "YiFan";
            TestItem.LastName    = "Wu";
            TestItem.Gender      = "Male";
            TestItem.Position    = "Officer";
            TestItem.Password    = "******";
            TestItem.Attendence  = 99.6;
            TestItem.Address     = "London";
            TestItem.PhoneNumber = "+12345679";
            //set the crecod based on the new test data
            AllStaffs.ThisStaff = TestItem;
            //update the record
            AllStaffs.Update();
            //find the record
            AllStaffs.ThisStaff.Search(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllStaffs.ThisStaff, TestItem);
        }
예제 #19
0
        public void StaffListOK()
        {
            clsStaffCollection allStaff = new clsStaffCollection();

            List <clsStaff> tstList = new List <clsStaff>();

            clsStaff tstItem = new clsStaff();

            tstItem.EmployeeNo = 1;
            tstItem.salary     = 10000;
            tstItem.first_name = "Jeff";
            tstItem.last_name  = "Jeffy";
            tstItem.active     = true;

            tstList.Add(tstItem);

            allStaff.StaffList = tstList;

            Assert.AreEqual(allStaff.StaffList, tstList);
        }
예제 #20
0
    private void DisplayStaff()
    {
        //create an instance of the address book
        clsStaffCollection StaffSystem = new clsStaffCollection();

        //find the record to update
        StaffSystem.ThisStaff.Find(StaffID);
        //display the data for this record
        txtStaffID.Text       = StaffSystem.ThisStaff.StaffID.ToString();
        txtDepartment.Text    = StaffSystem.ThisStaff.Department;
        txtJobTitle.Text      = StaffSystem.ThisStaff.JobTitle;
        txtName.Text          = StaffSystem.ThisStaff.Name;
        chkAvailable.Checked  = StaffSystem.ThisStaff.Available;
        txtExtension.Text     = StaffSystem.ThisStaff.Extension;
        txtPhoneNo.Text       = StaffSystem.ThisStaff.PhoneNo;
        txtHomeAddress.Text   = StaffSystem.ThisStaff.HomeAddress;
        txtPostcode.Text      = StaffSystem.ThisStaff.Postcode;
        txtCity.Text          = StaffSystem.ThisStaff.City;
        txtEnrolmentDate.Text = StaffSystem.ThisStaff.EnrolmentDate.ToString();
    }
        public void AddMethodOK()
        {
            clsStaffCollection AllStaff = new clsStaffCollection();
            clsStaff           TestItem = new clsStaff();
            Int32 PrimaryKey            = 0;

            TestItem.staff_id  = 1;
            TestItem.Name      = "Steve,Harris";
            TestItem.Email     = "*****@*****.**";
            TestItem.Hire_Date = DateTime.Now.Date;
            TestItem.Salary    = 7000.00;
            TestItem.Active    = true;
            AllStaff.ThisStaff = TestItem;
            PrimaryKey         = AllStaff.Add();
            TestItem.staff_id  = PrimaryKey;
            AllStaff.ThisStaff.Find(PrimaryKey);
            Assert.AreEqual(AllStaff.ThisStaff, TestItem);

            AllStaff.Delete();
        }
예제 #22
0
        public void DeleteMethodOK()
        {
            clsStaffCollection AllStaff  = new clsStaffCollection();
            clsStaff           TestStaff = new clsStaff();
            int PrimaryKey = 0;

            TestStaff.ID       = 1;
            TestStaff.Name     = "James";
            TestStaff.Address  = "40 Glenfield Road";
            TestStaff.DOB      = DateTime.Now.Date;
            TestStaff.Manager  = false;
            AllStaff.ThisStaff = TestStaff;
            PrimaryKey         = AllStaff.Add();
            TestStaff.ID       = PrimaryKey;
            AllStaff.ThisStaff.Find(PrimaryKey);
            AllStaff.Delete();
            Boolean Found = AllStaff.ThisStaff.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }
예제 #23
0
        public void ThisStaffPropertyOk()
        {
            //create an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create some test data to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set the properties of the test object
            TestStaff.Address     = "1 Dmu St  ";
            TestStaff.DateOfBirth = DateTime.Now.Date;
            TestStaff.FirstName   = "Mary";
            TestStaff.LastName    = "Zugs";
            TestStaff.NextOfKin   = "Dave Zugs";
            TestStaff.PhoneNo     = "781234562";
            TestStaff.StaffCode   = "MDZ123";
            //assign the data to the property
            AllStaff.ThisStaff = TestStaff;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
예제 #24
0
        public void ThisStaffPropertyOK()
        {
            //create an instance of the class
            clsStaffCollection AllStaff  = new clsStaffCollection();
            clsStaff           TestStaff = new clsStaff();

            // set its properties
            TestStaff.Active         = true;
            TestStaff.StaffNo        = 1;
            TestStaff.CountyNo       = 1;
            TestStaff.StaffFirstName = "Sally";
            TestStaff.StaffLastName  = "Gomery";
            TestStaff.AddressLine    = "8 Hillbilly State";
            TestStaff.PostCode       = "HG6 8SH";
            TestStaff.PhoneNo        = "07563856402";
            // add the itme to the test list
            AllStaff.ThisStaff = TestStaff;
            // assign the data to the property
            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
예제 #25
0
        public void ThisStaffPropertyOK()
        {
            //create an instance of the Staff Collection Class
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create the item of the test data
            clsStaff TestItem = new clsStaff();

            //set properties
            TestItem.Id          = 2;
            TestItem.Name        = "Oskar Karcz";
            TestItem.Email       = "*****@*****.**";
            TestItem.PhoneNumber = 112;
            TestItem.Roles       = "Admin";
            TestItem.Gender      = false;
            TestItem.DOB         = Convert.ToDateTime("19/04/1996");
            //assign the data to the property
            AllStaff.ThisStaff = TestItem;
            //test to see thisStaff matches the test data
            Assert.AreEqual(AllStaff.ThisStaff, TestItem);
        }
예제 #26
0
        protected void btnYes_Click(object sender, EventArgs e)
        {
            ///this function handles the click event of the Yes button

            //create an instance of the class clsLaptopCollection called MyLaptop
            clsStaffCollection Staff = new clsStaffCollection();
            //declare a boolean variable to record success of the delete operation
            Boolean Found;
            //try and find the record to delete
            Found = Staff.ThisStaff.Find(StaffNo);
            //if the record is found
            if (Found)
            {
                //invoke the delete method of the object
                Staff.Delete();
            }
            //redircet bact to the main page
            Response.Redirect("StaffManagement.aspx");

        }
예제 #27
0
        public void ThisStaffMemberOK()
        {
            //create an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //creat some test data to assign to the property
            clsStaff TestItem = new clsStaff();

            //set its properties
            TestItem.StaffID       = 7;
            TestItem.FullName      = "Full Name";
            TestItem.Salary        = 7.78;
            TestItem.DateOfJoining = DateTime.Now.Date;
            TestItem.Position      = "staff";
            TestItem.FullTime      = true;
            TestItem.Active        = true;
            //assign the data to the staff member
            AllStaff.ThisStaff = TestItem;
            //test to see if the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestItem);
        }
예제 #28
0
        public void ThisCustomerPropertyOk()
        {
            //create an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create some test data to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set the properties of the test object
            TestStaff.Address         = "12 Square Street";
            TestStaff.StaffID         = 6;
            TestStaff.EmailAddress    = "*****@*****.**";
            TestStaff.Firstname       = "Hind";
            TestStaff.Surname         = "Sink";
            TestStaff.Password        = "******";
            TestStaff.TelephoneNumber = "01164534587";
            //assign the data to the property
            AllStaff.ThisStaff = TestStaff;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
예제 #29
0
        public void ThisStaffPropertyOK()
        {
            //create an instance of the class we want to create
            clsStaffCollection AllStaff = new clsStaffCollection();
            //create some test data to assign to the property
            clsStaff TestStaff = new clsStaff();

            //set the properties of the test object
            TestStaff.Address   = "8 Bingan Street";
            TestStaff.Forename  = "Ryan";
            TestStaff.Mobile    = 07714890621;
            TestStaff.NI_Number = "PA098746Y";
            TestStaff.Postcode  = "LE4 8UY";
            TestStaff.Salary    = 18000;
            TestStaff.Surname   = "Fryer";
            TestStaff.Staff_ID  = 1;
            //assign the data to the property
            AllStaff.ThisStaff = TestStaff;
            //test to see that the two values are the same
            Assert.AreEqual(AllStaff.ThisStaff, TestStaff);
        }
        public void AddMethodOK()
        {
            clsStaffCollection AllStaff = new clsStaffCollection();
            clsStaff           TestItem = new clsStaff();
            Int32 PrimaryKey            = 0;

            TestItem.StaffID      = 1;
            TestItem.StaffName    = "Matthew Smith";
            TestItem.StaffAddress = "15 Somewhere Road";
            TestItem.StartDate    = DateTime.Now.Date;
            TestItem.Salary       = 13500;
            TestItem.Manager      = true;

            AllStaff.ThisStaff = TestItem;
            PrimaryKey         = AllStaff.Add();

            TestItem.StaffID = PrimaryKey;
            AllStaff.ThisStaff.Find(PrimaryKey);

            Assert.AreEqual(AllStaff.ThisStaff, TestItem);
        }