Example #1
0
        public void UpdateMethodOk()
        {
            clsOrderLineCollection AllLines = new clsOrderLineCollection();
            clsOrderLine           TestItem = new clsOrderLine();
            Int32 PrimaryKey = 0;

            TestItem.OrderLineId     = 1;
            TestItem.OrderId         = 1;
            TestItem.ItemNo          = 1;
            TestItem.ItemDescription = "Test Item";
            TestItem.Quantity        = 1;
            TestItem.UnitCost        = 15;
            AllLines.ThisOrderLine   = TestItem;
            PrimaryKey               = AllLines.Add();
            TestItem.OrderLineId     = PrimaryKey;
            TestItem.OrderId         = 2;
            TestItem.ItemNo          = 8;
            TestItem.ItemDescription = "Test Item 2";
            TestItem.Quantity        = 2;
            TestItem.UnitCost        = 25;
            AllLines.ThisOrderLine   = TestItem;
            AllLines.Update();
            AllLines.ThisOrderLine.Find(PrimaryKey);
            Assert.AreEqual(AllLines.ThisOrderLine, TestItem);
        }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clsOrderLine anOrderLine = new clsOrderLine();

        anOrderLine = (clsOrderLine)Session["anOrderLine"];
        Response.Write(anOrderLine.OrderNo);
    }
Example #3
0
    protected void BtnOK_Click(object sender, EventArgs e)
    {
        clsOrderLine anOrderLine = new clsOrderLine();

        Session["anOrderLine"] = anOrderLine;
        Response.Redirect("OrderLineViewer.aspx");
    }
Example #4
0
        public void AddMethodOK()
        {
            //instance of class
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            //create item for test data
            clsOrderLine TestItem = new clsOrderLine();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set properties
            TestItem.OrderId   = 1;
            TestItem.ProductId = "123abc";
            TestItem.Price     = 24.99;
            TestItem.Quantity  = 3;
            TestItem.Available = true;
            //set ThisOrder to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            //add the record
            PrimaryKey = AllOrderLines.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            //test if values are the same
            Assert.AreEqual(AllOrderLines.ThisOrderLine, TestItem);
        }
Example #5
0
        public void UpdateMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderLineCollection AllOrderLines = 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.OrderID   = "5";
            TestItem.ProductID = "5";
            //set ThisOrder to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            //add the record
            PrimaryKey = AllOrderLines.Add();
            //set the primary key of the test data
            TestItem.OrderLineID = PrimaryKey;
            //modify the test data
            TestItem.OrderID   = "6";
            TestItem.ProductID = "6";
            //set the record based on the new test data
            AllOrderLines.ThisOrderLine = TestItem;
            //update the record
            AllOrderLines.Update();
            //fnd the record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            //test to see thisorderline matches the test data
            Assert.AreEqual(AllOrderLines.ThisOrderLine, TestItem);
        }
Example #6
0
    protected void btnOKOrderLine_Click(object sender, EventArgs e)
    {
        clsOrderLine AnOrderLine          = new clsOrderLine();
        string       orderID              = OrderIDFind.Text;
        string       productID            = ProductIDFind.Text;
        string       selectionDescription = SelectionDescriptionFind.Text;
        string       quantity             = QuantityList.Text;
        string       Error = "";

        Error = AnOrderLine.Valid(orderID, productID, quantity, selectionDescription);
        if (Error == "")
        {
            AnOrderLine.orderID              = Convert.ToInt32(OrderIDFind.Text);
            AnOrderLine.productID            = Convert.ToInt32(ProductIDFind.Text);
            AnOrderLine.selectionDescription = SelectionDescriptionFind.Text;
            AnOrderLine.quantity             = Convert.ToInt32(QuantityList.Text);
            clsOrderLineCollection OrderLineList = new clsOrderLineCollection();
            if (OrderLineID == -1)
            {
                OrderLineList.ThisOrderLine = AnOrderLine;
                OrderLineList.Add();
            }
            else
            {
                OrderLineList.ThisOrderLine.Find(OrderLineID);
                OrderLineList.ThisOrderLine = AnOrderLine;
                OrderLineList.Update();
            }
            Response.Redirect("OrderLineList.aspx");
        }
        else
        {
            Label2.Text = Error;
        }
    }
Example #7
0
        public void InstanceOk()
        {
            // check that instance is ok
            clsOrderLine AnOrderLine = new clsOrderLine();

            Assert.IsNotNull(AnOrderLine);
        }
Example #8
0
        public void OrderLineListOK()
        {
            //create an instance of the class we want to create
            clsOrderLineCollection AllOrders = new clsOrderLineCollection();
            //create test data to assign to the property
            //data needs to be a list of objects
            List <clsOrderLine> TestList = new List <clsOrderLine>();
            //add item to the list
            //create the item of test data
            clsOrderLine TestItem = new clsOrderLine();

            //set its properties
            TestItem.OrderLineID = 2;
            TestItem.OrderNo     = 2;
            TestItem.TrainerID   = 2;
            TestItem.OrderLineID = 2;
            TestItem.OrderQty    = 1;
            TestItem.Price       = 2;
            //add the item to the list
            TestList.Add(TestItem);
            //assign the data to the property
            AllOrders.OrderLineList = TestList;
            //test to see that the two values are the same
            Assert.AreEqual(AllOrders.OrderLineList, TestList);
        }
Example #9
0
        public void AddMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderLineCollection AllOrders = 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 = 2;
            TestItem.OrderNo     = 2;
            TestItem.TrainerID   = 2;
            TestItem.OrderLineID = 2;
            TestItem.OrderQty    = 1;
            TestItem.Price       = 2;
            //set ThisOrder to the test data
            AllOrders.ThisOrderLine = TestItem;
            //add the record
            PrimaryKey = AllOrders.Add();
            //set the primary key to the test data
            TestItem.OrderNo = PrimaryKey;
            //find the record
            AllOrders.ThisOrderLine.Find(PrimaryKey);

            //test to see that two values are the same
            Assert.AreEqual(AllOrders.ThisOrderLine, TestItem);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        clsOrderLine AnOrderLine = new clsOrderLine();

        AnOrderLine = (clsOrderLine)Session["AnOrderLine"];
        Response.Write(AnOrderLine.orderLineID);
    }
Example #11
0
        public void DeleteMethodOK()
        {
            clsOrderLineCollection orderLines = new clsOrderLineCollection();

            clsOrderLine orderLine = new clsOrderLine
            {
                OrderId     = 3,
                OrderLineId = 1,
                ProductId   = 1,
                Quantity    = 5
            };

            Int32 primaryKey = 0;

            orderLines.ThisOrderLine = orderLine;

            primaryKey = orderLines.Add();

            orderLine.OrderLineId = primaryKey;

            orderLines.ThisOrderLine.find(primaryKey);

            orderLines.Delete();

            Assert.IsFalse(orderLines.ThisOrderLine.find(primaryKey));
        }
Example #12
0
        public void DeleteMethodOK()
        {
            //create an instance of the class we want to create
            clsOrderLineCollection AllOrderLines = 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 = 5;
            TestItem.OrderID     = "5";
            TestItem.ProductID   = "5";
            //set ThisOrder to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            //add the record
            PrimaryKey = AllOrderLines.Add();
            //set the primary key of the test data
            TestItem.OrderLineID = PrimaryKey;
            //Find the record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            //delete the record
            AllOrderLines.Delete();
            //now find the record
            Boolean Found = AllOrderLines.ThisOrderLine.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
        public void UpdateMethodOk()
        {
            // create instance of class to test
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            // create test data
            clsOrderLine TestItem = new clsOrderLine();
            // primary key var
            Int32 PrimaryKey = 0;

            // set properties for test data
            TestItem.orderID       = 1;
            TestItem.staffID       = 1;
            TestItem.orderComplete = true;
            // set ThisAddress to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            // add the record
            PrimaryKey = AllOrderLines.Add();
            // set primary key of test data
            TestItem.orderLineID = PrimaryKey;
            // modify test data
            TestItem.orderID       = 3;
            TestItem.staffID       = 1;
            TestItem.orderComplete = true;
            // set record based on new test data
            AllOrderLines.ThisOrderLine = TestItem;
            // update the record
            AllOrderLines.Update();
            // find record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            // test that ThisOrderLine matches the test data
            Assert.AreEqual(AllOrderLines.ThisOrderLine, TestItem);
        }
        public void AddMethodOK()
        {
            //create class instance
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            // create test data
            clsOrderLine TestItem = new clsOrderLine();
            // primary key variable
            Int32 PrimaryKey = 0;

            // set properties
            TestItem.orderLineID   = 1;
            TestItem.orderID       = 1;
            TestItem.staffID       = 1;
            TestItem.orderComplete = true;
            //set this order to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            // add record
            PrimaryKey = AllOrderLines.Add();
            // set primary key of test data
            TestItem.orderLineID = PrimaryKey;
            // find record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            // test values are the same
            Assert.AreEqual(AllOrderLines.ThisOrderLine, TestItem);
        }
Example #15
0
        public void DeleteMethodOK()
        {
            //instance of class
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            //create item for test data
            clsOrderLine TestItem = new clsOrderLine();
            //var to store the primary key
            Int32 PrimaryKey = 0;

            //set properties
            TestItem.OrderId   = 1;
            TestItem.ProductId = "123abc";
            TestItem.Price     = 24.99;
            TestItem.Quantity  = 3;
            TestItem.Available = true;
            //set ThisOrder to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            //add the record
            PrimaryKey = AllOrderLines.Add();
            //set the primary key of the test data
            TestItem.OrderId = PrimaryKey;
            //find the record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            //delete the record
            AllOrderLines.Delete();
            //now find the record
            Boolean Found = AllOrderLines.ThisOrderLine.Find(PrimaryKey);

            //test to see that the record was not found
            Assert.IsFalse(Found);
        }
        public void DeleteMethodOK()
        {
            //create class instance
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();
            // create test data
            clsOrderLine TestItem = new clsOrderLine();
            // primary key variable
            Int32 PrimaryKey = 0;

            // set properties
            TestItem.orderID       = 1;
            TestItem.orderLineID   = 1;
            TestItem.staffID       = 1;
            TestItem.orderComplete = true;
            //set this order to the test data
            AllOrderLines.ThisOrderLine = TestItem;
            // add record
            PrimaryKey = AllOrderLines.Add();
            // set primary key of test data
            TestItem.orderLineID = PrimaryKey;
            // find record
            AllOrderLines.ThisOrderLine.Find(PrimaryKey);
            // delete record
            AllOrderLines.Delete();
            // find the record again
            Boolean Found = AllOrderLines.ThisOrderLine.Find(PrimaryKey);

            // test that record was not found
            Assert.IsFalse(Found);
        }
Example #17
0
        public void InstanceOK()
        {
            //creating an instance of a class we want to create
            clsOrderLineCollection AllOrderLines = new clsOrderLineCollection();

            //test if it exists
            Assert.IsNotNull(AllOrderLines);
            //create a list of objects
            List <clsOrderLine> TestList = new List <clsOrderLine>();
            //add an intem into the list
            //create the item of test data
            clsOrderLine TestItem = new clsOrderLine();

            //set its properties
            TestItem.OrderId   = 1;
            TestItem.ProductId = "123abc";
            TestItem.Price     = 24.99;
            TestItem.Quantity  = 3;
            TestItem.Available = true;
            //add the item to the test list
            TestList.Add(TestItem);
            //assign data to property
            AllOrderLines.OrderLineList = TestList;
            //test if values are the same
            Assert.AreEqual(AllOrderLines.OrderLineList, TestList);
        }
Example #18
0
        public void OrderIdPropertyOk()
        {
            clsOrderLine AnItem   = new clsOrderLine();
            Int32        TestData = 1;

            AnItem.OrderId = TestData;
            Assert.AreEqual(AnItem.OrderId, TestData);
        }
Example #19
0
        public void ValidMethodOk()
        {
            clsOrderLine AnItem = new clsOrderLine();
            string       Error  = "";

            Error = AnItem.Valid(OrderId, ItemNo, ItemDescription, Quantity, UnitCost);
            Assert.AreEqual(Error, "");
        }
Example #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        clsOrderLine orderLine = new clsOrderLine();

        orderLine = (clsOrderLine)Session["orderLine"];

        Response.Write(orderLine.OrderLineId);
    }
Example #21
0
        public void selectionDescriptionPropertyOK()
        {
            clsOrderLine anOrderLine = new clsOrderLine();
            String       TestData    = "This is the selection";

            anOrderLine.selectionDescription = TestData;
            Assert.AreEqual(anOrderLine.selectionDescription, TestData);
        }
Example #22
0
        public void QuantityPropertyOk()
        {
            clsOrderLine AnItem   = new clsOrderLine();
            Int32        TestData = 1;

            AnItem.Quantity = TestData;
            Assert.AreEqual(AnItem.Quantity, TestData);
        }
Example #23
0
        public void ItemNoPropertyOk()
        {
            clsOrderLine AnItem   = new clsOrderLine();
            Int32        TestData = 1;

            AnItem.ItemNo = TestData;
            Assert.AreEqual(AnItem.ItemNo, TestData);
        }
Example #24
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsOrderLine AnOrderLine = new clsOrderLine();

            //test to see that it exists
            Assert.IsNotNull(AnOrderLine);
        }
Example #25
0
        public void ItemDescriprionPropertyOk()
        {
            clsOrderLine AnItem   = new clsOrderLine();
            String       TestData = "Test Item";

            AnItem.ItemDescription = TestData;
            Assert.AreEqual(AnItem.ItemDescription, TestData);
        }
Example #26
0
        public void productIDPropertyOK()
        {
            clsOrderLine anOrderLine = new clsOrderLine();
            int          TestData    = 6234;

            anOrderLine.productID = TestData;
            Assert.AreEqual(anOrderLine.productID, TestData);
        }
Example #27
0
        public void UnitCostPropertyOk()
        {
            clsOrderLine AnItem   = new clsOrderLine();
            Decimal      TestData = 1;

            AnItem.UnitCost = TestData;
            Assert.AreEqual(AnItem.UnitCost, TestData);
        }
Example #28
0
        public void quantityPropertyOK()
        {
            clsOrderLine anOrderLine = new clsOrderLine();
            int          TestData    = 2;

            anOrderLine.quantity = TestData;
            Assert.AreEqual(anOrderLine.quantity, TestData);
        }
Example #29
0
        public void InstanceOK()
        {
            //Creating the istance of a class
            clsOrderLine AnOrderLine = new clsOrderLine();

            //test that it exist
            Assert.IsNotNull(AnOrderLine);
        }
Example #30
0
        public void orderIDPropertyOK()
        {
            clsOrderLine anOrderLine = new clsOrderLine();
            int          TestData    = 1234;

            anOrderLine.orderID = TestData;
            Assert.AreEqual(anOrderLine.orderID, TestData);
        }