コード例 #1
0
        public void FindMethodOk()
        {
            //create new instance of customer
            ClsCustomer aCustomer = new ClsCustomer();
            //boolean variable to store result of method
            Boolean Found = false;
            //create test data
            Int32 CustomerID = 2;

            //invoke method
            Found = aCustomer.Find(CustomerID);
            //test to see if result is correct
            Assert.IsTrue(Found);
        }
コード例 #2
0
        public void CustomerCardDateFound()
        {
            //create new customer
            ClsCustomer aCustomer = new ClsCustomer();
            //boolean variable to store result method
            Boolean Found = false;
            //boolean variable to record if data is OK (assumes that it is)
            Boolean Ok = true;
            //creates some test data to assign to use with the method
            Int32 cID = 2;

            //invoke the method
            Found = aCustomer.Find(cID);
            //check the customer name
            if (aCustomer.CardDate != Convert.ToDateTime("24/07/2023"))
            {
                Ok = false;
            }
            //test to check result is correct
            Assert.IsTrue(Ok);
        }
コード例 #3
0
        public void CustomerPhoneNumberFound()
        {
            //create new customer
            ClsCustomer aCustomer = new ClsCustomer();
            //boolean variable to store result method
            Boolean Found = false;
            //boolean variable to record if data is OK (assumes that it is)
            Boolean Ok = true;
            //creates some test data to assign to use with the method
            Int32 cID = 2;

            //invoke the method
            Found = aCustomer.Find(cID);
            //check the customer name
            if (aCustomer.PhoneNumber != "8888")
            {
                Ok = false;
            }
            //test to check result is correct
            Assert.IsTrue(Ok);
        }
コード例 #4
0
        public void CustomerNotFound()
        {
            //Creates an instance of customer
            ClsCustomer aCustomer = new ClsCustomer();
            //boolean variable to store result method
            Boolean Found = false;
            //boolean variable to record if data is OK (assumes that it is)
            Boolean Ok = true;
            //creates some test data to assign to use with the method
            Int32 cID = 2;

            //invoke the method
            Found = aCustomer.Find(cID);
            //check the customer id number
            if (aCustomer.CustomerID != 2)
            {
                Ok = false;
            }
            //test to check result is correct
            Assert.IsTrue(Ok);
        }
コード例 #5
0
        public void CustomerNameFound()
        {
            //create new customer and new name
            Name        cName     = new Name("Gordon", "Smith");
            ClsCustomer aCustomer = new ClsCustomer();
            //boolean variable to store result method
            Boolean Found = false;
            //boolean variable to record if data is OK (assumes that it is)
            Boolean Ok = true;
            //creates some test data to assign to use with the method
            Int32 cID = 2;

            //invoke the method
            Found = aCustomer.Find(cID);
            //check the customer name
            if (aCustomer.CustomerName.getFullName() != cName.getFullName())
            {
                Ok = false;
            }
            //test to check result is correct
            Assert.IsTrue(Ok);
        }
コード例 #6
0
    public void btnFind_Click(object sender, EventArgs e)
    {
        ClsCustomer aCustomer = new ClsCustomer();

        Int32 cID;

        Boolean Found = false;

        cID = Convert.ToInt32(txtCustomerID.Text);

        Found = aCustomer.Find(cID);
        if (Found == true)
        {
            txtFirstName.Text   = aCustomer.CustomerName.getFirstName();
            txtLastName.Text    = aCustomer.CustomerName.getLastName();
            txtDateOfBirth.Text = aCustomer.DateOfBirth.ToString();
            txtEmail.Text       = aCustomer.Email;
            txtPhoneNumber.Text = aCustomer.PhoneNumber;
            txtPassword.Text    = aCustomer.Password;
            txtCardNo.Text      = aCustomer.CardNo;
            txtCardDate.Text    = aCustomer.CardDate.ToString();
        }
    }