public void ConsultantListOK()
 {
     //create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     //create some test data to assign to the property
     //in this case the data needs to be a list of objects
     List<clsConsultant> TestList = new List<clsConsultant>();
     //add an item to the list
     //create the item of the test data
     clsConsultant TestItem = new clsConsultant();
     //set its properties
     TestItem.Status = true;
     TestItem.ConsultantNo = 1;
     TestItem.FirstName = "John";
     TestItem.LastName = "Wayne";
     TestItem.DateOfBirth = DateTime.Now.Date;
     TestItem.Address = "Flat BC, 2 Cilantro Road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07437320192";
     TestItem.EmergencyContact = "07528789924";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 172;
     TestItem.EmploymentHistory = "None";
     TestItem.DateAdded = DateTime.Now.Date;
     //add the item to the test list
     TestList.Add(TestItem);
     //assign the data to the property
     AllConsultants.ConsultantList = TestList;
     //test to see that the two values are the same
     Assert.AreEqual(AllConsultants.ConsultantList, TestList);
 }
 public void AddMethodOK()
 {
     //create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     clsConsultant TestItem = new clsConsultant();
     //var to store the primary key
     Int32 PrimaryKey = 0;
     //set its properties
     TestItem.Status = true;
     TestItem.ConsultantNo = 120;
     TestItem.FirstName = "James";
     TestItem.LastName = "Junior";
     TestItem.DateOfBirth = DateTime.Now.Date.AddYears(-17);
     TestItem.Address = "Flat C, Colly road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07437320192";
     TestItem.EmergencyContact = "07528789924";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 129;
     TestItem.EmploymentHistory = "None";
     TestItem.DateAdded = DateTime.Now.Date;
     //set ThisConsultant to the test data
     AllConsultants.ThisConsultant = TestItem;
     //add the record
     PrimaryKey = AllConsultants.AddNew();
     //set the primary key of the test data
     TestItem.ConsultantNo = PrimaryKey;
     //find the record
     AllConsultants.ThisConsultant.Find(PrimaryKey);
     //test to see that the two values are the same
     Assert.AreEqual(AllConsultants.ThisConsultant, TestItem);
 }
Пример #3
0
 public void AddressMid()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to use with the method
     string FirstName = "James";
     string LastName = "mmmmmm";
     string Address = "CERRFlat2CBASTREETLEICERRFlat2";
     string Email = "*****@*****.**";
     string DateAdded = DateTime.Now.Date.ToString();
     string EmploymentHistory = "None";
     //invoke the method
     OK = AConsultant.Valid(FirstName, LastName, Address, Email, EmploymentHistory, DateAdded);
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
 public void AllConsultantsOK()
 {
     //Create an instance of the class we want to create
     clsConsultantCollection Consultants = new clsConsultantCollection();
     //create some test data to assign to the property
     //in this case the data needs to be a list of objects
     List<clsConsultant> TestList = new List<clsConsultant>();
     //add an item to the list
     //create an item of test data
     clsConsultant TestItem = new clsConsultant();
     //set its properties
     TestItem.ConsultantNo = 1;
     TestItem.FirstName = "James";
     //add the item to the test list
     TestList.Add(TestItem);
     //assign the data to the property
     Consultants.AllConsultants = TestList;
     //test to see that the two values are the same
     Assert.AreEqual(Consultants.AllConsultants, TestList);
 }
        //public constructor for the class
        public clsConsultantCollection()
        {
            //var for the index
            Int32 Index = 0;
            //var to store the record count
            Int32 RecordCount = 0;
            //object for data connection
            clsDataConnection DB = new clsDataConnection();
            //execute the stored procedure
            DB.Execute("sproc_tblConsultant_SelectAll");
            //get the count of records
            RecordCount = DB.Count;
            //while there are records to process
            while (Index < RecordCount)
            {
                //create a blank Consultant
                clsConsultant AConsultant = new clsConsultant();
                //read in the fields from the current record
                AConsultant.ConsultantNo = Convert.ToInt32(DB.DataTable.Rows[Index]["ConsultantNo"]);
                AConsultant.FirstName = Convert.ToString(DB.DataTable.Rows[Index]["FirstName"]);
                AConsultant.LastName = Convert.ToString(DB.DataTable.Rows[Index]["LastName"]);
                AConsultant.Address = Convert.ToString(DB.DataTable.Rows[Index]["Address"]);
                AConsultant.Email = Convert.ToString(DB.DataTable.Rows[Index]["Email"]);
                AConsultant.TelephoneNo = Convert.ToString(DB.DataTable.Rows[Index]["TelephoneNo"]);
                AConsultant.EmergencyContact = Convert.ToString(DB.DataTable.Rows[Index]["EmergencyContact"]);
                AConsultant.HoursOfWork = Convert.ToInt32(DB.DataTable.Rows[Index]["HoursOfWork"]);
                AConsultant.DateOfBirth = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateOfBirth"]);
                AConsultant.EmploymentDate = Convert.ToDateTime(DB.DataTable.Rows[Index]["EmploymentDate"]);
                AConsultant.Status = Convert.ToBoolean(DB.DataTable.Rows[Index]["Status"]);
                AConsultant.DateAdded = Convert.ToDateTime(DB.DataTable.Rows[Index]["DateAdded"]);

                //add the record to the private data member
                ConsultantList.Add(AConsultant);
                //point at the next record
                Index++;
            }
        }
Пример #6
0
 public void InstanceOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //test to see if it exists
     Assert.IsNotNull(AConsultant);
 }
Пример #7
0
 public void LastNameMid()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to use with the method
     string FirstName = "James"; //This should pass
     string LastName = "abcdmjmjmghhasmjkloithkgk";
     string Address = "flat b 2, thml";
     string Email = "*****@*****.**";
     string DateAdded = DateTime.Now.Date.ToString();
     string EmploymentHistory = "None";
     //invoke the method
     OK = AConsultant.Valid(FirstName, LastName, Address, Email, EmploymentHistory, DateAdded);
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Пример #8
0
 public void FirstNamePropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     string TestData = "Frank";
     //assign the data to the property
     AConsultant.FirstName = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.FirstName, TestData);
 }
Пример #9
0
 public void HoursOfWorkPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     Int32 TestData = 127;
     //assign the data to the property
     AConsultant.HoursOfWork = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.HoursOfWork, TestData);
 }
Пример #10
0
 public void AddressPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     string TestData = "21 bart road";
     //assign the data to the property
     AConsultant.Address = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.Address, TestData);
 }
Пример #11
0
        public void TestHoursOfWorkFound()
        {
            //create an instance of the class we want to create
            clsConsultant AConsultant = new clsConsultant();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record ifdata is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 ConsultantNo = 2;
            //invoke the method
            Found = AConsultant.Find(ConsultantNo);
            //check the Consultant No
            if (AConsultant.HoursOfWork != 128)
            {

                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Пример #12
0
 public void TestTelNoFound()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean varibale to store the result of the validation
     Boolean Found = false;
     //boolean variable to store the result of the search
     Boolean OK = true;
     //create some test data to use with the method
     Int32 ConsultantNo = 1;
     //invoke the method
     Found = AConsultant.Find(ConsultantNo);
     //check the ConsultantNo
     if (AConsultant.TelephoneNo != "07548389201")
     {
         OK = false;
     }
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
 public void ThisConsultantPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     clsConsultant TestItem = new clsConsultant();
     //set its properties
     TestItem.Status = true;
     TestItem.ConsultantNo = 1;
     TestItem.FirstName = "John";
     TestItem.LastName = "Wayne";
     TestItem.DateOfBirth = DateTime.Now.Date;
     TestItem.Address = "Flat BC, 2 Cilantro Road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07437320192";
     TestItem.EmergencyContact = "07528789924";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 172;
     TestItem.EmploymentHistory = "None";
     TestItem.DateAdded = DateTime.Now.Date;
     //assign the data to the property
     AllConsultants.ThisConsultant = TestItem;
     //test to see that the two values are the same
     Assert.AreEqual(AllConsultants.ThisConsultant, TestItem);
 }
Пример #14
0
 public void EmploymentDatePropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     DateTime TestData = DateTime.Now.Date;
     //assign the data to the property
     AConsultant.EmploymentDate = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.EmploymentDate, TestData);
 }
Пример #15
0
 public void EmploymentHistoryPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     string TestData = "Not Applicable";
     //assign the data to the property
     AConsultant.EmploymentHistory = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.EmploymentHistory, TestData);
 }
Пример #16
0
 public void EmergencyContactPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     string TestData = "0752879265";
     //assign the data to the property
     AConsultant.EmergencyContact = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.EmergencyContact, TestData);
 }
Пример #17
0
 public void EmailPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     string TestData = "*****@*****.**";
     //assign the data to the property
     AConsultant.Email = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.Email, TestData);
 }
Пример #18
0
 public void DateAddedMinPlusOne()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to use with the method
     string FirstName = "James";
     string LastName = "mmmmmm";
     string Address = "flat b 2, thml";
     string Email = "*****@*****.**";
     string EmploymentHistory = "None";
     //create a variable to store the test date data
     DateTime TestDate;
     //set the date to todays date
     TestDate = DateTime.Now.Date;
     //change the date to tomorrow (+1)
     TestDate = TestDate.AddDays(1);
     //convert the date variable to string variable
     string DateAdded = TestDate.ToString();
     //invoke the method
     OK = AConsultant.Valid(FirstName, LastName, Address, Email, DateAdded, EmploymentHistory);
     //test to see that the result is correct
     Assert.IsFalse(OK);
 }
 public void DeleteMethodOK()
 {
     //create an instance of the class we want to create
     clsConsultantCollection AllConsultants = new clsConsultantCollection();
     clsConsultant TestItem = new clsConsultant();
     //var to store the primary key
     Int32 PrimaryKey = 0;
     //set its properties
     TestItem.Status = true;
     TestItem.ConsultantNo = 119;
     TestItem.FirstName = "James";
     TestItem.LastName = "Junior";
     TestItem.DateOfBirth = DateTime.Now.Date.AddYears(-17);
     TestItem.Address = "Flat C, Basil road";
     TestItem.Email = "*****@*****.**";
     TestItem.TelephoneNo = "07528789965";
     TestItem.EmergencyContact = "07528789965";
     TestItem.EmploymentDate = DateTime.Now.Date;
     TestItem.HoursOfWork = 129;
     TestItem.EmploymentHistory = "None";
     TestItem.DateAdded = DateTime.Now.Date;
     //set ThisConsultant to the test data
     AllConsultants.ThisConsultant = TestItem;
     //add the record
     PrimaryKey = AllConsultants.AddNew();
     //set the primary key of the test data
     TestItem.ConsultantNo = PrimaryKey;
     //find the record
     AllConsultants.ThisConsultant.Find(PrimaryKey);
     //delete the record
     AllConsultants.Delete();
     //now find the record
     Boolean Found = AllConsultants.ThisConsultant.Find(PrimaryKey);
     //test to see that the record wasn't found
     Assert.IsFalse(Found);
 }
Пример #20
0
 public void TelephoneNoPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     string TestData = "+44752890120";
     //assign the data to the property
     AConsultant.TelephoneNo = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.TelephoneNo, TestData);
 }
Пример #21
0
 public void TestEmploymentDateFound()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean varibale to store the result of the validation
     Boolean Found = false;
     //boolean variable to store the result of the search
     Boolean OK = true;
     //create some test data to use with the method
     Int32 ConsultantNo = 1;
     //invoke the method
     Found = AConsultant.Find(ConsultantNo);
     //check the ConsultantNo
     if (AConsultant.EmploymentDate != Convert.ToDateTime("12/12/2014"))
     {
         OK = false;
     }
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Пример #22
0
 public void FirstNameMaxLessOne()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to use with the method
     string FirstName = "Abcdhfmhklfigmahsmghcksmsdmjnbhmklowpoutfghmglava"; //This should pass
     string LastName = "mmmmmm";
     string Address = "flat b 2, thml";
     string Email = "*****@*****.**";
     string DateAdded = DateTime.Now.Date.ToString();
     string EmploymentHistory = "None";
     //invoke the method
     OK = AConsultant.Valid(FirstName, LastName, Address, Email, EmploymentHistory, DateAdded);
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Пример #23
0
 public void EmploymentMinPlusOne()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean variable to store the result of the validation
     Boolean OK = false;
     //create some test data to use with the method
     string FirstName = "James";
     string LastName = "mmmmmm";
     string Address = "FlatB2CTHYMEROADLESS";
     string Email = "[email protected]";
     string DateAdded = DateTime.Now.Date.ToString();
     string EmploymentHistory = "Fired";
     //invoke the method
     OK = AConsultant.Valid(FirstName, LastName, Address, Email, EmploymentHistory, DateAdded);
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Пример #24
0
 public void ValidMethodOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean variable to store the result of the vaidation
     Boolean OK = false;
     //create some test data to use with the method
     string FirstName = "James";
     string LastName = "James";
     string Address = "Flat C, Colly road";
     string Email = "*****@*****.**";
     string EmploymentHistory = "Employed";
     string DateAdded = DateTime.Now.Date.ToString();
     //invoke the method
     OK = AConsultant.Valid(FirstName, LastName, Address, Email, EmploymentHistory, DateAdded);
     //test to see that the result is correct
     Assert.IsTrue(OK);
 }
Пример #25
0
 public void FindMethodOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //boolean variable to store the result of the vaidation
     Boolean Found = false;
     //create some test data to use with the method
     Int32 ConsultantNo = 2;
     //invoke the method
     Found = AConsultant.Find(ConsultantNo);
     //test to see that the result is correct
     Assert.IsTrue(Found);
 }
Пример #26
0
 public void StatusPropertyOK()
 {
     //create an instance of the class we want to create
     clsConsultant AConsultant = new clsConsultant();
     //create some test data to assign to the property
     Boolean TestData = true;
     //assign the data to the property
     AConsultant.Status = TestData;
     //test to see that the two values are the same
     Assert.AreEqual(AConsultant.Status, TestData);
 }