Exemplo n.º 1
0
        public void PriceMid()
        {
            //create an instance of the class we want to create
            clsOrder Order = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //this should pass
            Double Price = 91.50;

            //invoke the method
            Error = Order.Valid(ProductName, ProductNo, OrderNo, Date, Price);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 2
0
        public void DateInvalidData()
        {
            //create an instance of the class we want to create
            clsOrder Order = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //convert the date variable to a string variable
            string Date = "This is NOT a date";

            //invoke the method
            Error = Order.Valid(ProductName, ProductNo, OrderNo, Date, Price);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 3
0
        public void ProductNameMaxLessOne()
        {
            //create an instance of the class we want to create
            clsOrder Order = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            string ProductName = "aaaaa"; //this should be ok

            //invoke the method
            Error = Order.Valid(ProductName, ProductNo, OrderNo, Date, Price);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 4
0
        public void AddressMinPlusOne()
        {
            //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 Address = "aa";

            //invoke the method
            Error = AnOrder.Valid(Address, DeliveryDate, DatePurchased);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 5
0
        public void ShippingAddressExtremeMax()
        {
            //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 the method
            string ShippingAddress = "";                          //This should trigger an error

            ShippingAddress = ShippingAddress.PadRight(500, 'a'); //This should fail
            //Invoke the method
            Error = AnOrder.Valid(DateAdded, Description, ShippingAddress, Quantity);
            //Test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 6
0
        public void dDispatchMax()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //create some test data
            String   Error = "";
            DateTime TestDate;

            TestDate = DateTime.Now.Date;
            string DDispatch = TestDate.ToString();

            //set the test data to the method
            Error = AnOrder.Valid(CId, CAddress, DDispatch, IName, IQuantity);
            //check to see they are both equal
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 7
0
        public void dDispatchInvalidData()
        {
            //create an instance of the class
            clsOrder AnOrder = new clsOrder();
            //create some test data
            String Error     = "";
            string CId       = "3";
            string CAddress  = "3 Bobby Avenue";
            string IName     = "Some Movie";
            string IQuantity = "12";
            string DDispatch = "this is not a date!";

            //set the test data to the method
            Error = AnOrder.Valid(CId, CAddress, DDispatch, IName, IQuantity);
            //check to see they are not equal
            Assert.AreNotEqual(Error, "");
        }
Exemplo n.º 8
0
        public void DateAddedMin()
        {
            //Create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //String variable to store any error message
            String Error = "";
            //Create a variable to store the test date data
            DateTime TestDate;

            //Set the date to today's date
            TestDate = DateTime.Now.Date;
            //Convert the date variable to a string variable
            string DateAdded = TestDate.ToString();

            //Invoke the method
            Error = AnOrder.Valid(DateAdded, Description, ShippingAddress, Quantity);
            //Test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 9
0
        public void DateAddedMin()
        {
            //create an instance of the class we want to create
            clsOrder Order = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            DateTime TestDate;

            //set the date to todays date
            TestDate = DateTime.Now.Date;
            //convert the date variable to a string variable
            string Date = TestDate.ToString();

            //invoke the method
            Error = Order.Valid(ProductName, ProductNo, OrderNo, Date, Price);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Exemplo n.º 10
0
        public void DatePurchasedMin()
        {
            //create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            DateTime TestDate;

            //set the date totodays date
            TestDate = DateTime.Now.Date;
            //convert the date variable to a string variable
            string DatePurchased = TestDate.ToString();

            //invoke the method
            Error = AnOrder.Valid(Address, DeliveryDate, DatePurchased);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }