public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsCourses aCourse = new clsCourses();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //Create some test data to use with the method
            Int32 IDno = 1;

            //invoke the method
            Found = aCourse.Find(IDno);
            //Test to see that the result is correct
            Assert.IsTrue(Found);
        }
        public void TestAvailableFound()
        {
            //create an instance of the class we want to create
            clsCourses aCourse = new clsCourses();
            //boolean variable 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 methods
            Boolean Available = Convert.ToBoolean(true);

            //invoke the method
            Found = aCourse.Find(1);
            //check the address no
            if (aCourse.Available != true)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void TestCategoryFound()
        {
            //create an instance of the class we want to create
            clsCourses aCourse = new clsCourses();
            //boolean variable 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 methods
            String Category = Convert.ToString("Technology");

            //invoke the method
            Found = aCourse.Find(1);
            //check the address no
            if (aCourse.Category != "Technology")
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
        public void TestLiveDateFound()
        {
            //create an instance of the class we want to create
            clsCourses aCourse = new clsCourses();
            //boolean variable 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 methods
            DateTime LiveDate = Convert.ToDateTime("01/01/2020");

            //DateTime LiveDate = 01/01/2020;
            //invoke the method
            Found = aCourse.Find(1);
            //check the address no
            if (aCourse.LiveDate != Convert.ToDateTime("01/01/2020"))
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Ejemplo n.º 5
0
    protected void Find_Click(object sender, EventArgs e)
    {
        //create a new instance of clsCourses
        clsCourses aCourse = new clsCourses();
        //variable to store the primary key
        Int32 IDno;
        //variable to store the result of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        IDno = Convert.ToInt32(txtIDno.Text);
        //find the record
        Found = aCourse.Find(IDno);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form
            txtIDno.Text           = aCourse.IDno.ToString();
            txtTitleCourse.Text    = aCourse.Title;
            txtCategoryCourse.Text = aCourse.Category;
            txtTutorCourse.Text    = aCourse.Tutor;
            if (aCourse.LiveDate.Day < 10 & aCourse.LiveDate.Month < 10)
            {
                txtLiveDateCourse.Text = "0" + aCourse.LiveDate.Day + "/0" + aCourse.LiveDate.Month + "/" + aCourse.LiveDate.Year;
            }
            else if (aCourse.LiveDate.Day < 10)
            {
                txtLiveDateCourse.Text = "0" + aCourse.LiveDate.Day + "/" + aCourse.LiveDate.Month + "/" + aCourse.LiveDate.Year;
            }
            else if (aCourse.LiveDate.Month < 10)
            {
                txtLiveDateCourse.Text = aCourse.LiveDate.Day + "/0" + aCourse.LiveDate.Month + "/" + aCourse.LiveDate.Year;
            }
            Available.Text      = aCourse.Available.ToString();
            txtpriceCourse.Text = aCourse.Price.ToString();
        }
    }