public void AppointmentDeleteMethodOK()
        {
            //create an instance of the class we wantto create
            clsAppointmentCollection AllAppointments = new clsAppointmentCollection();
            //create an item for tests data
            clsAppointments TestItem = new clsAppointments();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its props
            //TestItem.StaffNo = 0;
            TestItem.AppointmentTitle = "TestAddMethodAppointmentTitle";
            TestItem.ClientNo         = 5;
            TestItem.StaffNo          = 7;
            TestItem.Location         = "TestAddBirminghamOffice";
            TestItem.BookingDate      = DateTime.Now.Date;
            TestItem.Status           = "Pending";
            //Set this staff to the test data
            AllAppointments.ThisAppointment = TestItem;
            //add the record
            PrimaryKey = AllAppointments.Add();
            //set the primary key of the test data
            TestItem.AppointmentNo = PrimaryKey;
            //find the recird
            AllAppointments.ThisAppointment.Find(PrimaryKey);
            //delete the record
            AllAppointments.Delete();
            //now find the record
            Boolean Found = AllAppointments.ThisAppointment.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
        public void AppointmentAddMethodOK()
        {
            //create an instance of the class we wantto create
            clsAppointmentCollection AllAppointments = new clsAppointmentCollection();
            //create an item for tests data
            clsAppointments TestItem = new clsAppointments();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its props
            //TestItem.AppointmentNo = 0;
            TestItem.AppointmentTitle = "TestAddMethodAppointmentTitle";
            TestItem.ClientNo         = 5;
            TestItem.StaffNo          = 7;
            TestItem.Location         = "TestAddBirminghamOffice";
            TestItem.BookingDate      = DateTime.Now.Date;
            TestItem.Status           = "Pending";
            //Set this appointment to the test data
            AllAppointments.ThisAppointment = TestItem;
            //add the record
            PrimaryKey = AllAppointments.Add();
            //set the primary key of the test data
            TestItem.AppointmentNo = PrimaryKey;
            //find the recird
            AllAppointments.ThisAppointment.Find(PrimaryKey);
            //test to see that the two values are the same
            Assert.AreEqual(AllAppointments.ThisAppointment, TestItem);
        }
示例#3
0
        public void BookingDateExtremeMax()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentTitle = "Website";
            string ClientNo         = "1";
            string Location         = "Birmingham";
            string StaffNo          = "1";
            string Status           = "Pending";
            //crate a variable to srtore the test date data
            DateTime TestDate;

            //set the date to todays date
            TestDate = DateTime.Now.Date;
            //change the date to whatever the day is plus 100 years
            TestDate = TestDate.AddYears(100);
            //convert the date variable to a string variable
            string BookingDate = TestDate.ToString();

            //invoke this method
            OK = AnAppointment.Valid(AppointmentTitle, BookingDate, ClientNo, Location, StaffNo, Status);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
        public void ListAndCountOK()
        {
            //create an instance of the class we want to create
            clsAppointmentCollection AllAppointments = new clsAppointmentCollection();
            //create some test data to assign to the property
            //in this case the data needs to be a list of onjects
            List <clsAppointments> TestList = new List <clsAppointments>();
            //add an item to the list
            //create the item of test data
            clsAppointments TestItem = new clsAppointments();

            //set its properties
            TestItem.AppointmentNo    = 1;
            TestItem.AppointmentTitle = "Website";
            TestItem.BookingDate      = DateTime.Now.Date;
            TestItem.ClientNo         = 1;
            TestItem.Location         = "Birmingham";
            TestItem.StaffNo          = 1;
            TestItem.Status           = "Pending";
            //add the item to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllAppointments.AppointmentList = TestList;
            //test to see that the twqo value are the same
            Assert.AreEqual(AllAppointments.Count, TestList.Count);
        }
示例#5
0
        public void InstanceOK()
        {
            //create an instance of a class
            clsAppointments TestAppointments = new clsAppointments();

            //evaluate class for content
            Assert.IsNotNull(TestAppointments);
        }
示例#6
0
        public void AppointmentInstanceOK()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();

            //test to see that it exists
            Assert.IsNotNull(AnAppointment);
        }
示例#7
0
        public void AppointmentDetailsMid()
        {
            //create an instance of a class
            clsAppointments TestAppointment = new clsAppointments();
            //declare testing variable
            Boolean OK = false;
            string  SomeApointments = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

            OK = TestAppointment.ValidAppointmentDetailMid(SomeApointments);
            Assert.IsTrue(OK);
        }
示例#8
0
        public void AppointmentDetailsMin()
        {
            //create an instance of a class
            clsAppointments TestAppointment = new clsAppointments();
            //declare testing variable
            Boolean OK;

            //pass data to the class library for testing
            OK = TestAppointment.ValidAppointmentDetailMin("a");
            //evaluate return value
            Assert.IsTrue(OK);
        }
示例#9
0
        public void AppointmentDateOK()
        {
            //create an instance of a class
            clsAppointments TestDetails = new clsAppointments();
            //create some test data to assign to the property
            DateTime TestData = DateTime.Now.Date;

            //assign the data to the property
            TestDetails.AppointmentDate = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(TestDetails.AppointmentDate, TestData);
        }
示例#10
0
        public void AppointmentTitlePropertyOK()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //create some test data to assign to the property
            string TestData = "Website";

            //assign the data to the property
            AnAppointment.AppointmentTitle = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnAppointment.AppointmentTitle, TestData);
        }
示例#11
0
        public void AppointmentStaffNoPropertyOK()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //create some test data to assign to the property
            Int32 TestData = 1;

            //assign the data to the property
            AnAppointment.StaffNo = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnAppointment.StaffNo, TestData);
        }
示例#12
0
        public void AppointmentIDInvalidDataType()
        {
            //create an instance of a class
            clsAppointments TestAppointmentID = new clsAppointments();
            //declare testing variable
            Boolean OK;

            //pass data to the class library for testing
            OK = TestAppointmentID.AppointmentInvalid("aaaaaa");
            //evaluate return value
            Assert.IsTrue(OK);
        }
示例#13
0
        public void AppointmentIDMinBoundary()
        {
            //create an instance of a class
            clsAppointments TestAppointmentID = new clsAppointments();
            //declare testing variable
            Boolean OK;

            //pass data to the class library for testing
            OK = TestAppointmentID.ValidAppointmentIDMin(00000001);
            //evaluate return value
            Assert.IsTrue(OK);
        }
示例#14
0
        public void AppointmentBookingDatePropertyOK()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //create some test data to assign to the property
            DateTime TestData = DateTime.Now.Date;

            //assign the data to the property
            AnAppointment.BookingDate = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnAppointment.BookingDate, TestData);
        }
示例#15
0
        public void AppointmentLocationPropertyOK()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //create some test data to assign to the property
            string TestData = "LondonOffice";

            //assign the data to the property
            AnAppointment.Location = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AnAppointment.Location, TestData);
        }
示例#16
0
        public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //create some test data to pass to the method
            Int32 AppointmentNo = 1;

            //invoke the method
            Found = AnAppointment.Find(AppointmentNo);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
示例#17
0
        public void AppointmentIDOK()
        {
            //create an instance of a class
            clsAppointments TestDetails = new clsAppointments();
            //declare testing variable
            Int32 TestData;

            //assign value to test variable
            TestData = 1;
            //pass data to properites within class library
            TestDetails.AppointmentID = TestData;
            //evaluate the outcome
            Assert.AreEqual(TestDetails.AppointmentID, TestData);
        }
示例#18
0
        public void FindMethodOK()
        {
            //create an instance of a class
            clsAppointments TestAppointmentDate = new clsAppointments();
            //boolean varibale to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 AppointmentID = 2;

            //invoke the method
            Found = TestAppointmentDate.Find(AppointmentID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
示例#19
0
        public void AppointmentDetailsInvaild()
        {
            //create an instance of a class
            clsAppointments TestAppointmentDate = new clsAppointments();
            //boolean varibale to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentDetails = "";
            //create varible to store the test date data
            //set the dataadded to a non date value
            string AppointmentDate = "12/09/2015";

            //invoke the method
            OK = TestAppointmentDate.ValidAppointmentDate(AppointmentDetails, AppointmentDate);
            //test to see that the results is correct
            Assert.IsFalse(OK);
        }
示例#20
0
        public void StatusMid()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentTitle = "Website";
            string ClientNo         = "1";
            string Location         = "Birmingham";
            string StaffNo          = "1";
            string Status           = "qwertyuiop"; //VARCHAR(20) so 10 characters
            string BookingDate      = Convert.ToString(DateTime.Now.Date);

            //invoke this method
            OK = AnAppointment.Valid(AppointmentTitle, BookingDate, ClientNo, Location, StaffNo, Status);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
示例#21
0
        public void StatusMinLessOne()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentTitle = "Website";
            string ClientNo         = "1";
            string Location         = "Birmingham";
            string StaffNo          = "1";
            string Status           = "";
            string BookingDate      = "17/03/2017";

            //invoke this method
            OK = AnAppointment.Valid(AppointmentTitle, BookingDate, ClientNo, Location, StaffNo, Status);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
示例#22
0
        public void LocationMinPlusOne()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentTitle = "Website";
            string ClientNo         = "1";
            string Location         = "aa";
            string StaffNo          = "1";
            string Status           = "Pending";
            string BookingDate      = Convert.ToString(DateTime.Now.Date);

            //invoke this method
            OK = AnAppointment.Valid(AppointmentTitle, BookingDate, ClientNo, Location, StaffNo, Status);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
示例#23
0
        public void AppointmentTitleMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentTitle = "qwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopq"; //this should fail (51 characters) VARCHAR50
            string BookingDate      = DateTime.Now.Date.ToString();
            string ClientNo         = "1";
            string Location         = "Birmingham";
            string StaffNo          = "1";
            string Status           = "Pending";

            //invoke this method
            OK = AnAppointment.Valid(AppointmentTitle, BookingDate, ClientNo, Location, StaffNo, Status);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
示例#24
0
        public void BookingDateInvalidData()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentTitle = "Website";
            string ClientNo         = "1";
            string Location         = "Birmingham";
            string StaffNo          = "1";
            string Status           = "Pending";
            //set the DateAdded to a non date value
            string BookingDate = "this is not a date";

            //invoke this method
            OK = AnAppointment.Valid(AppointmentTitle, BookingDate, ClientNo, Location, StaffNo, Status);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
        public void ThisAppointmentPropertyOK()
        {
            //create an instance of the class we want to create
            clsAppointmentCollection AllAppointments = new clsAppointmentCollection();
            //create some test data to assign to the property
            clsAppointments TestAppointment = new clsAppointments();

            //set the properties of the test object
            TestAppointment.AppointmentNo    = 1;
            TestAppointment.AppointmentTitle = "Website;";
            TestAppointment.BookingDate      = DateTime.Now.Date;
            TestAppointment.ClientNo         = 1;
            TestAppointment.Location         = "Birmingham";
            TestAppointment.StaffNo          = 1;
            TestAppointment.Status           = "Pending";
            //assign the data to the property
            AllAppointments.ThisAppointment = TestAppointment;
            //test to see that the two values are the same
            Assert.AreEqual(AllAppointments.ThisAppointment, TestAppointment);
        }
        public void ListAndCountOK()
        {
            //create an instance of a class
            clsAppointmentCollection AllAppointments = new clsAppointmentCollection();
            //create some test data to assign to the property
            List <clsAppointments> TestList = new List <clsAppointments>();
            //add items to list
            //create the item of test data
            clsAppointments TestItem = new clsAppointments();

            //set its properties
            TestItem.AppointmentID      = 2;
            TestItem.AppointmentDetails = "Software Upgrade";
            TestItem.AppointmentDate    = Convert.ToDateTime("16/9/2016");
            //add items to the test list
            TestList.Add(TestItem);
            //assign the data to the property
            AllAppointments.AppointmentsList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllAppointments.Count, TestList.Count);
        }
示例#27
0
        public void TestAppointmentID()
        {
            //create an instance of a class
            clsAppointments TestAppointmentID = new clsAppointments();
            //boolean varibale to store the result of the validation
            Boolean Found = false;
            //boolean variable to record if data is OK (Assume it is)
            Boolean OK = true;
            //create some test data to use with the method
            Int32 AppointmentID = 2;

            //invoke the method
            Found = TestAppointmentID.Find(AppointmentID);
            //check the property
            if (TestAppointmentID.AppointmentID != 2)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
示例#28
0
        public void TestBookingDateFound()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to pass to the method
            Int32 AppointmentNo = 1;

            //invoke the method
            Found = AnAppointment.Find(AppointmentNo);
            //check the property
            if (AnAppointment.BookingDate != Convert.ToDateTime("10/02/2017"))
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
示例#29
0
        public void TestStatusFound()
        {
            //create an instance of the class we want to create
            clsAppointments AnAppointment = new clsAppointments();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to pass to the method
            Int32 AppointmentNo = 1;

            //invoke the method
            Found = AnAppointment.Find(AppointmentNo);
            //check the appointment title
            if (AnAppointment.Status != "Pending")
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
示例#30
0
        public void AppointmentDateExtremeMax()
        {
            //create an instance of a class
            clsAppointments TestAppointmentDate = new clsAppointments();
            //boolean varibale to store the result of the validation
            Boolean OK = false;
            //create some test data to pass to the method
            string AppointmentDetails = "Software Upgrade";
            //create varible to store the test date data
            DateTime TestDate;

            //set the date to todays date
            TestDate = DateTime.Now.Date.AddDays(1000);
            //change the date to whatever the date minus 365 days
            TestDate = TestDate.Date;
            //convert the date variable to a string variable
            string AppointmentDate = TestDate.ToString();

            //invoke the method
            OK = TestAppointmentDate.ValidAppointmentDate(AppointmentDetails, AppointmentDate);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }