コード例 #1
0
        public void FindMethodOK()
        {
            //create an instance of the class we eant to create
            clscustomer Acustomer = new clscustomer();
            //Bollean variable to store the results of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 CustomerNo = 1;

            //invoke the method
            Found = Acustomer.Find(CustomerNo);
            //test to see if the result is true
            Assert.IsTrue(Found);
        }
コード例 #2
0
        public void TestRegisteredFound()
        {
            //create an instance of the class we want to create
            clscustomer Acustomer = new clscustomer();
            //Bolean variable to store the results of the serach
            Boolean Found = false;
            //boolean variable to record if data is OK
            Boolean OK = true;
            //create some test data to use with the method
            Int32 CustomerNo = 1;

            //invoke the methods
            Found = Acustomer.Find(CustomerNo);
            //check the customer no
            if (Acustomer.Registered != true)
            {
                OK = false;
            }
            //test to see if the result is true
            Assert.IsFalse(OK);
        }
コード例 #3
0
        public void TestDOBFound()
        {
            //create an instance of the class we want to create
            clscustomer Acustomer = new clscustomer();
            //Bolean variable to store the results of the search
            Boolean Found = false;
            //boolean variable to record if data is OK
            Boolean OK = true;
            //create some test data to use with the method
            Int32 CustomerNo = 1;

            //invoke the methods
            Found = Acustomer.Find(CustomerNo);
            //check the customer no
            if (Acustomer.DOB != Convert.ToDateTime("15/01/1998"))
            {
                OK = false;
            }
            //test to see if the result is true
            Assert.IsTrue(OK);
        }
コード例 #4
0
        public void TestCustomerNoFound()
        {
            //create an instance of the class we eant to create
            clscustomer Acustomer = new clscustomer();
            //boolean varaible to store the result of the search
            Boolean Found = false;
            //boolean varaible to record if data is OK
            Boolean OK = true;
            //create some test data to use with the method
            Int32 CustomerNo = 1;

            //invoke the method
            Found = Acustomer.Find(CustomerNo);
            //check the customer no
            if (Acustomer.CustomerNo != 1)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
コード例 #5
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        //created an instance of the customer class
        clscustomer Acustomer = new clscustomer();
        //variable to store the primary key
        Int32 CustomerNo;
        //variable to tore the results of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        CustomerNo = Convert.ToInt32(txtCustomerNo.Text);
        //find the record
        Found = Acustomer.Find(CustomerNo);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form
            txtName.Text    = Acustomer.Name;
            txtEmail.Text   = Acustomer.Email;
            txtDOB.Text     = Acustomer.DOB.ToString();
            txtAddress.Text = Acustomer.Address;
        }
    }