Ejemplo n.º 1
0
        public void ShippingMethodMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //this should fail
            string ShippingMethod = "";

            //invoke the method
            Error = AnOrder.Valid(ShippingMethod, DateOrdered);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 2
0
        public void ValidExistsOrderNumber()
        {
            //Create instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //Boolean to store result of validation
            Boolean OK = false;
            //create test to assign to property
            Int32 SomeOrder = 1;

            //invoke method
            OK = AnOrder.Valid(SomeOrder);
            //test to see result is correct
            Assert.IsTrue(OK);
        }
Ejemplo n.º 3
0
        public void OrderDateInvalidData()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //set the DateAdded to a non date value
            string OrderDate = "this is not a date!";

            //invoke the method
            Error = AnOrder.Valid(OrderDate, OrderMadeBy, TotalPrice, OrderID, CustomerID, PhoneID, TariffID);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 4
0
        public void DateOrderedInvalidData()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //set the date to a non date value
            string DateOrdered = "this is not a date";

            //invoke the method
            Error = AnOrder.Valid(ShippingMethod, DateOrdered);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 5
0
        public void GameTitleMid()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string GameTitle = "aaaaaaaaaaaaaaaaaaaaaaaaa"; //this should be ok

            //invoke the method
            Error = AnOrder.Valid(GameTitle, TotalPrice, DeliveryDate);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 6
0
        public void DateInvalidData()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //set the date to a non date value
            string Date = "This is not a date";

            //invoke the method
            Error = AnOrder.Valid(Date, Email, Price);
            //test to see if result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 7
0
        public void OrderMadeByMinLessOne()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //create a string variable to store the result of the validation
            string Error = "";
            //creating test data to test the method
            string OrderMadeBy = "";

            //Invoke the method
            Error = AnOrder.Valid(OrderDate, OrderMadeBy, TotalPrice, OrderID, CustomerID, PhoneID, TariffID);
            //test to see if the result is OK
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 8
0
        public void OrderDateInvalidData()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error messages
            String Error = "";
            //set the Order date to a non date value
            string OrderDate = "This is not a date!";

            //invoke the method
            Error = AnOrder.Valid(CustomerID, StaffID, OrderDate, OrderStatus);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 9
0
        public void OrderStatusMid()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error messages
            String Error = "";
            //this should fail
            string OrderStatus = "Deliv";

            //invoke the method
            Error = AnOrder.Valid(CustomerID, StaffID, OrderDate, OrderStatus);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 10
0
        public void StaffIDMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error messages
            String Error = "";
            //create some test data to pass the method
            string StaffID = "1000";//this should be ok

            //invoke the method
            Error = AnOrder.Valid(CustomerID, StaffID, OrderDate, OrderStatus);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 11
0
        public void PriceMid()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //string variable to any error message
            String Error = "";
            //this should pass
            string Price = "";

            //invoke the method
            Error = AnOrder.Valid(Date, Email, Price);
            //Test to see if the reuslt if correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 12
0
        public void CustomerIDMinPlusOne()
        {
            clsOrder AnOrder   = new clsOrder();
            String   Error     = "";
            DateTime dateToday = DateTime.Today.Date;
            string   date      = Convert.ToString(dateToday);
            string   price     = "20.99";
            string   staff     = "3";
            string   customer  = "2";
            string   address   = "14 Emerald, Leicester, LE3 5GA";

            Error = AnOrder.Valid(date, price, staff, customer, address);
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 13
0
        public void ValidMethodOK()
        {
            //create an instance of the class we want to create
            clsOrder AOrder = new clsOrder();
            //create a string variable to store the results of the validation
            String Error = "";
            //create some test data to test the method
            string SomeOrder = "Jake";

            //invoke the method
            Error = AOrder.Valid(SomeOrder);
            //test to see that the result is OK i.e there was no error message returned
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 14
0
        public void DeliveryAddressExtremeMax()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string DeliveryAddress = "";

            DeliveryAddress = DeliveryAddress.PadRight(500, 'a'); //this should fail
            //invoke the method
            Error = AnOrder.Valid(DateOrdered, DeliveryAddress);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 15
0
        public void CustomerIDExtremeMax()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error messages
            String Error = "";
            //create some test data to pass the method
            string CustomerID = "";//this should fail

            CustomerID = CustomerID.PadRight(500, '1');
            //invoke the method
            Error = AnOrder.Valid(CustomerID, StaffID, OrderDate, OrderStatus);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 16
0
        public void BookNameExtremeMax()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string BookName = "aaaaaaaa";

            BookName = BookName.PadRight(500, 'b');
            //invoke the method
            Error = AnOrder.Valid(BookName, Quantity, OrderDate, Price);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 17
0
        public void TrackingNoExtremeMax()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string TrackingNumber = "";

            TrackingNumber = TrackingNumber.PadRight(500, 'a');//this should fail
            //invoke the method
            Error = AnOrder.Valid(OrderNumber, CustomerName, Email, Quantity, ShippingDate, TrackingNumber);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 18
0
        public void ItemNameExtremeMax()
        {
            //create an instance of tyhe class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass the method
            string ItemName = "";                   //should fail

            ItemName = ItemName.PadRight(500, 'a'); //should fail
            //invoke the method
            Error = AnOrder.Valid(orderId, ItemName, Price, DateOrderMade, ItemShipped);
            //test to see that the results are correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 19
0
        public void EmailMid()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //this should pass
            string Email = "";

            Email = Email.PadRight(25, 'a');
            //invoke the method
            Error = AnOrder.Valid(OrderNumber, CustomerName, Email, Quantity, ShippingDate, TrackingNumber);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 20
0
        public void CustomerNameMaxPlusOne()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //this shold fail
            string CustomerName = "";

            CustomerName = CustomerName.PadRight(51, 'a');
            //invoke the method
            Error = AnOrder.Valid(OrderNumber, CustomerName, Email, Quantity, ShippingDate, TrackingNumber);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 21
0
        public void QuantityExtremeMax()
        {
            //create an instance of the class we want to create
            clsOrder AOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string Quantity = "100";

            //this should fail
            //invoke the method
            Error = AOrder.Valid(ItemName, Price, Quantity, Date);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 22
0
        public void DeliveryAddressMinPlusOne()
        {
            clsOrder AnOrder = new clsOrder();
            String   Error   = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string date     = TestDate.ToString();
            string price    = "20.99";
            string staff    = "20";
            string customer = "1";
            string address  = "aa";

            Error = AnOrder.Valid(date, price, staff, customer, address);
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 23
0
        public void TariffIDByMinPlusOne()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //create a string variable to store the result of the validation
            string Error = "";
            //Boolean OK = false;
            //creating test data to test the method
            string TariffID = "12";

            //Invoke the method
            //OK = AnOrder.Valid(OrderDate, OrderMadeBy, TotalPrice);
            Error = AnOrder.Valid(OrderDate, OrderMadeBy, TotalPrice, OrderID, CustomerID, PhoneID, TariffID);
            //test to see if the result is OK
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 24
0
        public void StaffIDExtremeMax()
        {
            clsOrder AnOrder = new clsOrder();
            string   Error   = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string date     = TestDate.ToString();
            string price    = "20.99";
            string staff    = "100";
            string customer = "1";
            string address  = "14 Emerald, Leicester, LE3 5GA";

            Error = AnOrder.Valid(date, price, staff, customer, address);
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 25
0
        public void CustomerIDMaxLessOne()
        {
            clsOrder AnOrder = new clsOrder();
            String   Error   = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string date     = TestDate.ToString();
            string price    = "20.99";
            string staff    = "3";
            string customer = "99998";
            string address  = "14 Emerald, Leicester, LE3 5GA";

            Error = AnOrder.Valid(date, price, staff, customer, address);
            Assert.AreEqual(Error, "");
        }
Ejemplo n.º 26
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        clsOrder AOrder             = new clsOrder();
        string   OrderID            = txtOrderID.Text;
        string   CustomerNo         = txtCustomerNo.Text;
        string   CustomerAddress    = txtCustomerAddress.Text;
        string   ItemColour         = txtItemColour.Text;
        string   ItemPrice          = txtItemPrice.Text;
        string   OrderDate          = txtOrderDate.Text;
        string   ProductDescription = txtProductDescription.Text;
        string   StaffID            = txtStaffID.Text;
        string   Error = "";

        Error = AOrder.Valid(OrderID, CustomerNo, CustomerAddress, OrderDate, ItemPrice, ItemColour, ProductDescription, StaffID);

        if (Error == "")

        {
            AOrder.OrderID            = Convert.ToInt32(OrderID);
            AOrder.CustomerNo         = Convert.ToInt32(CustomerNo);
            AOrder.CustomerAddress    = txtCustomerAddress.Text;
            AOrder.ItemColour         = txtItemColour.Text;
            AOrder.ItemPrice          = Convert.ToDecimal(ItemPrice);
            AOrder.OrderDate          = Convert.ToDateTime(OrderDate);
            AOrder.ProductDescription = txtProductDescription.Text;
            AOrder.Availability       = chkAvailability.Checked;
            AOrder.StaffID            = Convert.ToInt32(StaffID);
            clsOrderCollection OrderList = new clsOrderCollection();
            if (this.OrderID == -1)
            {
                OrderList.ThisOrder = AOrder;
                OrderList.Add();
            }
            else
            {
                OrderList.ThisOrder.Find(Convert.ToInt32(OrderID));
                OrderList.ThisOrder = AOrder;
                OrderList.Update();
            }
            Response.Redirect("OrderList.aspx");
        }
        else
        {
            //display error message
            lblError.Text = Error;
        }
    }
Ejemplo n.º 27
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        clsOrder Order       = new clsOrder();
        string   ProductName = txtProductName.Text;
        string   ProductNo   = txtProductNo.Text;
        //capture the StaffID
        string OrderNo = txtOrderNo.Text;
        //capture the Batch number
        string Price = txtPrice.Text;
        string Date  = txtDate.Text;
        //string Dispatched = txtDispatched.Text;
        // varlable to store any error messages
        string Error = "";

        //validate the data
        Error = Order.Valid(ProductNo, ProductName, OrderNo, Price, Date);
        if (Error == "")
        {
            Order.ProductName = txtProductName.Text;
            Order.ProductNo   = Convert.ToInt32(txtProductNo.Text);
            Order.OrderNo     = Convert.ToInt32(txtOrderNo.Text);
            Order.Price       = Convert.ToChar(txtPrice.Text);
            Order.Date        = Convert.ToDateTime(txtDate.Text);
            //Order.Dispatched = chkDispatched.Checked;
            Order.ProductName = txtProductName.Text;
            clsOrderCollection OrderList = new clsOrderCollection();

            if (OrderID == -1)
            {
                OrderList.ThisOrder = Order;
                OrderList.Add();
            }


            else
            {
                OrderList.ThisOrder.Find(OrderID);
                OrderList.ThisOrder = Order;
                OrderList.Update();
            }

            Response.Redirect("OrderList.aspx");

            lblError.Text = Error;
        }
    }
Ejemplo n.º 28
0
        public void PriceExtremeMin()
        {
            //create an instance of tyhe class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass the method
            double TestDouble;

            TestDouble = Double.MinValue;
            string Price = TestDouble.ToString(); //should trigger an error

            //invoke the method
            Error = AnOrder.Valid(orderId, ItemName, Price, DateOrderMade, ItemShipped);
            //test to see that the results are correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 29
0
        public void OrderTotlaInvalidData()
        {
            // create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            // string variable to store any error message
            String Error = "";
            // create some test data to pass to the method
            string FirstPrice  = Convert.ToString(1);
            string SecondPrice = Convert.ToString(7);
            string ThirdPrice  = Convert.ToString(2);
            string OrderTotal  = "This is not a price!";

            //invoke the method
            Error = AnOrder.Valid(FirstPrice, SecondPrice, ThirdPrice, OrderTotal);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Ejemplo n.º 30
0
        public void QuantityMid()
        {
            //Create instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //Boolean to store result of validation
            Boolean OK = false;
            //create test data to pass the method
            string DateOrdered = DateTime.Now.Date.ToString();
            string ProductName = "aa";
            string QuantityNo  = "5";
            String OrderPrice  = "1";

            //invoke method
            OK = AnOrder.Valid(DateOrdered, ProductName, QuantityNo, OrderPrice);
            //test to see result is correct
            Assert.IsTrue(OK);
        }