Exemplo n.º 1
0
    protected void Button_OrderLOK_Click(object sender, EventArgs e)
    {
        clsOrderline AnOrderL = new clsOrderline();
        string       ONumber  = TextBox_OrderLONumber.Text;
        string       Quantity = TextBox_OrderLQuantity.Text;
        string       ShoeID   = TextBox_ShoeID.Text;
        string       Error    = "";

        Error = AnOrderL.Valid(ONumber, Quantity, ShoeID);
        if (Error == "")
        {
            AnOrderL.OLineNumber = OLineNumber;
            AnOrderL.ONumber     = Convert.ToInt32(ONumber);
            AnOrderL.Quantity    = Convert.ToInt32(Quantity);
            AnOrderL.ShoeID      = Convert.ToInt32(ShoeID);
            clsOrderlineCollection OrderlineList = new clsOrderlineCollection();

            if (OLineNumber == -1)
            {
                OrderlineList.ThisOrderline = AnOrderL;
                OrderlineList.Add();
            }
            else
            {
                OrderlineList.ThisOrderline.Find(OLineNumber);
                OrderlineList.ThisOrderline = AnOrderL;
                OrderlineList.Update();
            }
            Response.Redirect("OrderlineList.aspx");
        }
        else
        {
            Label_OrderLError.Text = Error;
        }
    }
Exemplo n.º 2
0
        public void ValidMethodOK()
        {
            clsOrderline AnOrderline = new clsOrderline();
            String       Error       = "";

            Error = AnOrderline.Valid(ONumber, Quantity, ShoeID);
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 3
0
        public void InventoryIdExtremeMax()
        {
            clsOrderline AnOrderline = new clsOrderline();
            string       Error       = "";
            string       InventoryId = "50000000";

            Error = AnOrderline.Valid(OrderId, InventoryId, Quantity);
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 4
0
        public void InventoryIdMaxPlusOne()
        {
            clsOrderline AnOrderline = new clsOrderline();
            string       Error       = "";
            string       InventoryId = "100001";

            Error = AnOrderline.Valid(OrderId, InventoryId, Quantity);
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 5
0
        public void InventoryIdMinBoundary()
        {
            clsOrderline AnOrderline = new clsOrderline();
            string       Error       = "";
            string       InventoryId = "1";

            Error = AnOrderline.Valid(OrderId, InventoryId, Quantity);
            Assert.AreEqual(Error, "");
        }
        //used to test the valid method of the class
        public void ValidMethod()
        {
            //create an instance of a class
            clsOrderline AOrderline = new clsOrderline();
            //create a string variable to store the result of the validation
            string Error = "";

            //create some test data to test the method
            Error = AOrderline.Valid(SomeBookingNo, SomeQuantity);
            //test to see the result is ok. i.e there was no error mssage returned
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 7
0
        public void InventoryIdExtremeMin()
        {
            //create an instance of class Orderline
            clsOrderline AnOrderline = new clsOrderline();
            // create an string variable to store the result of validation
            string Error       = "";
            string InventoryId = "";

            // invoke the method
            Error = AnOrderline.Valid(OrderId, InventoryId, Quantity);
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 8
0
        public void ValidMethodOK()
        {
            //create an instance of class Orderline
            clsOrderline AnOrderline = new clsOrderline();
            // test to see that it exist
            string Error       = "";
            string OrderId     = 1.ToString();
            string InventoryId = 2.ToString();
            string Quantity    = 5.ToString();

            Error = AnOrderline.Valid(OrderId, InventoryId, Quantity);
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 9
0
        public void ShoeIDInvalidDataType()
        {
            //create an instance of the class we want to create
            clsOrderline AnOrderline = new clsOrderline();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            String ShoeID = "a"; //this should fail

            //invoke the method
            Error = AnOrderline.Valid(ONumber, Quantity, ShoeID);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
        public void QuantityMaxPlusOne()
        {
            //create an instance of a class
            clsOrderline AOrderline = new clsOrderline();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string SomeQuantity = "123456";

            //invoke the method
            Error = AOrderline.Valid(SomeBookingNo, SomeQuantity);
            //Test to see that the result is not ok. i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 11
0
        public void QuantityMinLessOne()
        {
            //create an instance of class Orderlineline
            clsOrderline AnOrderline = new clsOrderline();
            // create an string variable to store the result of validation
            String Error = "";
            // create some test data to the test method
            string Quantity = "0";

            // invoke the method
            Error = AnOrderline.Valid(OrderId, InventoryId, Quantity);
            // test to see that result is ok , e, g - There shold be an error message
            Assert.AreNotEqual(Error, "");
        }
        public void QuantityExtremeMax()
        {
            //create an instance of the class
            clsOrderline AOrderline = new clsOrderline();
            //create a string variable to store the result of the validation
            string Error = "";
            //create some test data to test the method
            string SomeQuantity = "";

            //pad the string with characters
            SomeQuantity = SomeQuantity.PadRight(20, 'a');
            //invoke the method
            Error = AOrderline.Valid(SomeBookingNo, SomeQuantity);
            //Test to see that the result is not ok. i.e there should be an error message
            Assert.AreNotEqual(Error, "");
        }