public void UpdateMethodOK()
        {
            ClsOrderCollection AllOrders = new ClsOrderCollection();
            ClsOrder           AnOrder   = new ClsOrder();
            int PrimaryKey = 0;

            AnOrder.CustomerID  = 2;
            AnOrder.CarID       = 2;
            AnOrder.DateOfOrder = DateTime.Now.Date;
            AnOrder.ServiceID   = 66;
            AnOrder.OrderPrice  = 50000;
            AnOrder.OrderStatus = "pending";
            AnOrder.PaymentID   = 3;
            AnOrder.Completed   = false;

            AllOrders.ThisOrder = AnOrder;
            PrimaryKey          = AllOrders.Add();
            AnOrder.OrderID     = PrimaryKey;

            AnOrder.CustomerID  = 2;
            AnOrder.CarID       = 2;
            AnOrder.DateOfOrder = DateTime.Now.Date;
            AnOrder.ServiceID   = 66;
            AnOrder.OrderPrice  = 50000;
            AnOrder.OrderStatus = "completed";
            AnOrder.PaymentID   = 3;
            AnOrder.Completed   = true;

            AllOrders.ThisOrder = AnOrder;
            AllOrders.Update();
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, AnOrder);
            AllOrders.Delete();
        }
Exemplo n.º 2
0
        public void DeleteMethodOK()
        {
            //creates instance of class we want to create
            ClsOrderCollection AllOrder = new ClsOrderCollection();
            //creates the item of test data
            ClsOrder TestItem = new ClsOrder();
            //Var to store primary key
            Int32 PrimaryKey = 0;

            //Sets its properties
            TestItem.OrderID         = 1;
            TestItem.CustomerID      = 45879632;
            TestItem.ShippingAddress = "64 potter Lane";
            TestItem.OrderStatus     = "pending";
            TestItem.OrderDate       = DateTime.Now.Date;
            TestItem.OrderShipped    = false;
            //set ThisOrder to the test data
            AllOrder.ThisOrder = TestItem;
            //add the record
            PrimaryKey = AllOrder.Add();
            //set primary key of the test data
            TestItem.OrderID = PrimaryKey;
            //find the record
            AllOrder.ThisOrder.Find(PrimaryKey);
            //delete the record
            AllOrder.Delete();
            //now find the record
            Boolean Found = AllOrder.ThisOrder.Find(PrimaryKey);

            //Test to see if the record was not found
            Assert.IsTrue(Found);
        }
Exemplo n.º 3
0
    protected void btnYes_Click(object sender, EventArgs e)
    {
        ClsOrderCollection Orders = new ClsOrderCollection();

        Orders.ThisOrder.Find(OrderID);
        Orders.Delete();
        Response.Redirect("OrderList.aspx");
    }
Exemplo n.º 4
0
    protected void BtnYes_Click(object sender, EventArgs e)
    {
        //create an instance of the Order Collection
        ClsOrderCollection OrderList = new ClsOrderCollection();

        //finds the record to delete
        OrderList.ThisOrder.Find(OrderID);
        //deletes the record
        OrderList.Delete();
        //Redirects back to the main page
        Response.Redirect("OrderList.aspx");
    }
        public void AddMethodOK()
        {
            ClsOrderCollection AllOrders = new ClsOrderCollection();
            ClsOrder           AnOrder   = new ClsOrder();
            int PrimaryKey = 0;

            AnOrder.CustomerID  = 2;
            AnOrder.CarID       = 2;
            AnOrder.DateOfOrder = DateTime.Now.Date;
            AnOrder.ServiceID   = 66;
            AnOrder.OrderPrice  = 5000;
            AnOrder.OrderStatus = "test";
            AnOrder.PaymentID   = 3;
            AnOrder.Completed   = true;
            AllOrders.ThisOrder = AnOrder;
            PrimaryKey          = AllOrders.Add();
            AnOrder.OrderID     = PrimaryKey;
            AllOrders.ThisOrder.Find(PrimaryKey);
            Assert.AreEqual(AllOrders.ThisOrder, AnOrder);
            AllOrders.Delete(); // This to delete the new record we have just made for consistancey with the rest of the test.
        }
        public void DeleteMethodOK()
        {
            ClsOrderCollection AllOrders = new ClsOrderCollection();
            ClsOrder           AnOrder   = new ClsOrder();
            int PrimaryKey = 0;

            AnOrder.CustomerID  = 2;
            AnOrder.CarID       = 2;
            AnOrder.DateOfOrder = DateTime.Now.Date;
            AnOrder.ServiceID   = 66;
            AnOrder.OrderPrice  = 50000;
            AnOrder.OrderStatus = "Done";
            AnOrder.PaymentID   = 3;
            AnOrder.Completed   = true;
            AllOrders.ThisOrder = AnOrder;
            PrimaryKey          = AllOrders.Add();
            AnOrder.OrderID     = PrimaryKey;
            AllOrders.ThisOrder.Find(PrimaryKey);
            AllOrders.Delete();
            bool Found = AllOrders.ThisOrder.Find(PrimaryKey);

            Assert.IsFalse(Found);
        }