Ejemplo n.º 1
0
        public void UpdateMethod()
        {
            //create an instance of a class
            clsOrderlineCollection AllOrderline = new clsOrderlineCollection();
            //create the item of test data
            clsOrderline TestItem = new clsOrderline();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.BookingID = 1;
            TestItem.BookingNo = "CASD4";
            TestItem.Quantity  = 10;
            //set ThisOrderline to the test data
            AllOrderline.ThisOrderline = TestItem;
            //add the record
            PrimaryKey = AllOrderline.Add();
            //set the primary key of the test data
            TestItem.OrderlineID = PrimaryKey;
            //modify the test data
            TestItem.BookingID = 3;
            TestItem.BookingNo = "FGSD7";
            TestItem.Quantity  = 5;
            //set the record based on the new test data
            AllOrderline.ThisOrderline = TestItem;
            //update the record
            AllOrderline.Update();
            //find the record
            AllOrderline.ThisOrderline.Find(PrimaryKey);
            //test to see thisOrderline matches the test data
            Assert.AreEqual(AllOrderline.ThisOrderline, TestItem);
        }
Ejemplo n.º 2
0
        public void DeleteMethod()
        {
            //create an instance of a class
            clsOrderlineCollection AllOrderline = new clsOrderlineCollection();
            //create the item of test data
            clsOrderline TestItem = new clsOrderline();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set its properties
            TestItem.OrderlineID = 1;
            TestItem.BookingID   = 1;
            TestItem.BookingNo   = "CASD4";
            TestItem.Quantity    = 10;
            //set ThisOrderline to the test data
            AllOrderline.ThisOrderline = TestItem;
            //add the record
            PrimaryKey = AllOrderline.Add();
            //set the primary key of the test data
            TestItem.OrderlineID = PrimaryKey;
            //find the record
            AllOrderline.ThisOrderline.Find(PrimaryKey);
            //delete the record
            AllOrderline.Delete();
            //now find the record
            Boolean Found = AllOrderline.ThisOrderline.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clsOrderline AnOrderline = new clsOrderline();

        AnOrderline = (clsOrderline)Session["AnOrderLine"];
        Response.Write(AnOrderline.ONumber);
    }
Ejemplo n.º 4
0
        public void DeleteMethodOK()
        {
            // create an instance for the class we want to create
            clsOrderlineCollection AllOrderline = new clsOrderlineCollection();

            // create the item of the test data
            clsOrderline TestItem = new clsOrderline();
            // var to store the primary key
            Int32 PrimaryKey = 0;

            // set it properties
            TestItem.OrderlineId = 2;
            TestItem.OrderId     = 4;
            TestItem.Quantity    = 1;
            TestItem.InventoryId = 1;


            // set thisAdress to the test data
            AllOrderline.ThisOrderline = TestItem;
            // add the record
            PrimaryKey = AllOrderline.Add();
            // set the primary key TestI data
            TestItem.OrderlineId = PrimaryKey;
            // find the record
            AllOrderline.ThisOrderline.Find(PrimaryKey);
            // delete the record
            AllOrderline.Delete();
            //now find the record
            Boolean Found = AllOrderline.ThisOrderline.Find(PrimaryKey);

            // test to see that the record was not found
            Assert.IsFalse(Found);
        }
Ejemplo n.º 5
0
        public void AddMethodOK()
        {
            // create an instance for the class we want to create
            clsOrderlineCollection AllOrderline = new clsOrderlineCollection();

            // create the item of the test data
            clsOrderline TestItem = new clsOrderline();

            // var to store the primary key
            Int32 PrimaryKey = 0;

            // set it properties
            TestItem.OrderlineId = 2;
            TestItem.OrderId     = 1;
            TestItem.Quantity    = 1;
            TestItem.InventoryId = 1;


            // set thisAdress to the test data
            AllOrderline.ThisOrderline = TestItem;
            // add the record
            PrimaryKey = AllOrderline.Add();
            // set the primary key TestI data
            TestItem.OrderlineId = PrimaryKey;
            // find the record
            AllOrderline.ThisOrderline.Find(PrimaryKey);

            // test to see that the two values are the same
            Assert.AreEqual(AllOrderline.ThisOrderline, TestItem);
        }
Ejemplo n.º 6
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;
        }
    }
Ejemplo n.º 7
0
        public void ValidMethodOK()
        {
            clsOrderline AnOrderline = new clsOrderline();
            String       Error       = "";

            Error = AnOrderline.Valid(ONumber, Quantity, ShoeID);
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 8
0
        public void QuantityOK()
        {
            clsOrderline AnOrderL = new clsOrderline();
            int          TestData = 1;

            AnOrderL.Quantity = TestData;
            Assert.AreEqual(AnOrderL.Quantity, TestData);
        }
Ejemplo n.º 9
0
        public void ONumberOK()
        {
            clsOrderline AnOrderL = new clsOrderline();
            int          TestData = 1;

            AnOrderL.ONumber = TestData;
            Assert.AreEqual(AnOrderL.ONumber, TestData);
        }
        public void InstanceOK()
        {
            //create an instance of a class
            clsOrderline AOrderline = new clsOrderline();

            //test to see that it exists
            Assert.IsNotNull(AOrderline);
        }
Ejemplo n.º 11
0
        public void ShoeIDOK()
        {
            clsOrderline AnOrderL = new clsOrderline();
            int          TestData = 4;

            AnOrderL.ShoeID = TestData;
            Assert.AreEqual(AnOrderL.ShoeID, TestData);
        }
Ejemplo n.º 12
0
        public void OrderlineIdPropertyOK()
        {
            clsOrderline AnOrderline = new clsOrderline();
            int          OrderlineId = 567;

            AnOrderline.OrderlineId = OrderlineId;
            Assert.AreEqual(OrderlineId, AnOrderline.OrderlineId);
        }
Ejemplo n.º 13
0
        public void InventoryIdExtremeMax()
        {
            clsOrderline AnOrderline = new clsOrderline();
            string       Error       = "";
            string       InventoryId = "50000000";

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

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

            Error = AnOrderline.Valid(OrderId, InventoryId, Quantity);
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 16
0
        public void FindMethodOK()
        {
            clsOrderline AnOrderline = new clsOrderline();
            Boolean      Found       = false;
            Int32        OLineNumber = 10;

            Found = AnOrderline.Find(OLineNumber);

            Assert.IsTrue(Found);
        }
        //used to test the booking no property of the class
        public void BookingNo()
        {
            //create an instance of a class
            clsOrderline AOrderline = new clsOrderline();
            //create some test data to assign to proprty
            string SomeBookingNo = "A6886";

            //assign data to property
            AOrderline.BookingNo = SomeBookingNo;
            //check to see the data in the variable and the property are the same
            Assert.AreEqual(AOrderline.BookingNo, SomeBookingNo);
        }
Ejemplo n.º 18
0
        public void InventoryIdPropertyOK()
        {
            //create an instance of class Orderlineline
            clsOrderline AnOrderline = new clsOrderline();
            // create some test dat to assign the property
            int InventoryId = 1;

            // assign the data to the property
            AnOrderline.InventoryId = InventoryId;
            //test to see that it exist
            Assert.AreEqual(AnOrderline.InventoryId, InventoryId);
        }
Ejemplo n.º 19
0
        public void QuantityPropertyOK()
        {
            //create an instance of class Orderlineline
            clsOrderline AnOrderline = new clsOrderline();
            // create some test dat to assign the property
            int Quantity = 1;

            // assign the data to the property
            AnOrderline.Quantity = Quantity;
            //test to see that it exist
            Assert.AreEqual(AnOrderline.Quantity, Quantity);
        }
        //used to test the quantity property of the class
        public void Quantity()
        {
            //create an instance of a class
            clsOrderline AOrderline = new clsOrderline();
            //create some test data to assign to proprty
            Int32 SomeQuantity = 1;

            //assign data to property
            AOrderline.Quantity = SomeQuantity;
            //check to see the data in the variable and the property are the same
            Assert.AreEqual(AOrderline.Quantity, SomeQuantity);
        }
        //used to test the booking id foregn key property of the class
        public void BookingID()
        {
            //create an instance of a class
            clsOrderline AOrderline = new clsOrderline();
            //create some test data to assign to proprty
            Int32 BookingID = 3;

            //assign data to property
            AOrderline.BookingID = BookingID;
            //check to see the data in the variable and the property are the same
            Assert.AreEqual(AOrderline.BookingID, BookingID);
        }
Ejemplo n.º 22
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, "");
        }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //create an instance of clsOrderline
        clsOrderline AOrderline = new clsOrderline();

        //get the data from the session object
        AOrderline = (clsOrderline)Session["AOrderline"];
        //display the booking number for this entry
        Response.Write(AOrderline.BookingNo);
        //display the quantity for this entry
        Response.Write(AOrderline.Quantity);
    }
        public void ThisOrderlineProperyOK()
        {
            clsOrderlineCollection AllOrderlines = new clsOrderlineCollection();
            clsOrderline           TestOrderline = new clsOrderline();

            TestOrderline.OLineNumber   = 1;
            TestOrderline.ONumber       = 1;
            TestOrderline.Quantity      = 1;
            TestOrderline.ShoeID        = 1;
            AllOrderlines.ThisOrderline = TestOrderline;
            Assert.AreEqual(AllOrderlines.ThisOrderline, TestOrderline);
        }
        //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, "");
        }
Ejemplo n.º 26
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, "");
        }
Ejemplo n.º 27
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, "");
        }
Ejemplo n.º 28
0
        public void FindMethod()
        {
            //create an instance of a class
            clsOrderline AOrderline = new clsOrderline();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 OrderlineID = 44;

            //invoke the method
            Found = AOrderline.Find(OrderlineID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
        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, "");
        }
Ejemplo n.º 30
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, "");
        }