Ejemplo n.º 1
0
    protected void BtnFind_Click(object sender, EventArgs e)
    {
        var aPolicy = new clsPolicy();
        int PolicyIdTemp;

        if (!int.TryParse(txtPolicyId.Text, out PolicyIdTemp))
        {
            lblError.Text = string.Format("<br /><b>PolicyID: {0}</b> is not Integer!", txtPolicyId.Text);
        }
        else
        {
            PolicyId            = PolicyIdTemp;
            Session["PolicyId"] = PolicyId;
            var Found = aPolicy.Find(PolicyId);
            if (!Found)
            {
                string errorString = string.Format("<br /><b>PolicyID: {0}</b> Not In DB. Try a different PolicyID!<br />", PolicyId);
                lblError.Text = errorString;
                return;
            }
            txtPolicyId.Text          = aPolicy.PolicyId.ToString();
            txtStaffId.Text           = aPolicy.StaffId.ToString();
            txtCustomerId.Text        = aPolicy.CustomerId.ToString();
            txtPolicyDetails.Text     = aPolicy.PolicyDetails;
            txtPrice.Text             = aPolicy.Price.ToString();
            chkAccepted.Checked       = aPolicy.Accepted;
            calStartDate.VisibleDate  = aPolicy.StartDate;
            calStartDate.SelectedDate = aPolicy.StartDate;
        }
    }
Ejemplo n.º 2
0
        public void FindMethodOK()
        {
            //Instantiate The class
            var aPolicy = new clsPolicy();
            //test data
            const int PolicyId = 7;
            //boolean var to store the result of the validation
            //invoke the method
            var Found = aPolicy.Find(PolicyId);

            //test for equality
            Assert.IsTrue(Found);
        }
Ejemplo n.º 3
0
        public void TestPriceFound()
        {
            //Instantiate The class
            var aPolicy = new clsPolicy();
            //boolean var to record if data is OK (assume it is)
            var OK = true;
            //test data
            const int PolicyId = 7;

            //boolean car to store the result of search
            //invoke method
            _ = aPolicy.Find(PolicyId);
            //check the policy id
            if (aPolicy.Price != 99.64M)
            {
                OK = false;
            }

            //test to see the result is correct
            Assert.IsTrue(OK);
        }
Ejemplo n.º 4
0
        public void TestPolicyDetailsFound()
        {
            //Instantiate The class
            var aPolicy = new clsPolicy();
            //boolean var to record if data is OK (assume it is)
            var OK = true;
            //test data
            const int PolicyId = 7;

            //boolean car to store the result of search
            //invoke method
            _ = aPolicy.Find(PolicyId);
            //check the policy id
            if (aPolicy.PolicyDetails != "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.")
            {
                OK = false;
            }

            //test to see the result is correct
            Assert.IsTrue(OK);
        }