예제 #1
0
        public void ProductPriceExtremeMax()
        {
            //creates an instance of a class
            clsProduct AProduct        = new clsProduct();
            string     ProductName     = "Lenovo11";
            string     ProductQuantity = "10";
            string     ProductPrice    = "99999999999999999.99";
            //string variable to store any error message
            String Error = "";

            //create some data for testing with the method
            //invoke the method

            Error = AProduct.valid(ProductName, ProductQuantity, ProductPrice);
            //test to see the result is correct
            Assert.AreNotEqual(Error, "");
        }
예제 #2
0
        public void ValidMethodOk()
        {
            //creates an instance of a class
            clsProduct AProduct = new clsProduct();
            //string variable to store any erroe message
            String Error = "";

            //create some data for testing with the method

            string ProductName     = "Lenovo11";
            string ProductPrice    = "2";
            string ProductQuantity = "10.20";

            //invoke the method
            Error = AProduct.valid(ProductName, ProductPrice, ProductQuantity);
            Assert.AreEqual(Error, "");
        }
예제 #3
0
        public void ProductNameMaxPlusOne()
        {
            //creates an instance of a class
            clsProduct AProduct = new clsProduct();
            string     Error    = "";
            ////string variable to store any error message
            //String Error = "";

            //create some data for testing with the method

            string ProductName     = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwx"; //this should trigger the error
            string ProductQuantity = "10";
            string ProductPrice    = "10.20";

            //invoke the method

            Error = AProduct.valid(ProductName, ProductPrice, ProductQuantity);
            //test to see the result is correct
            Assert.AreEqual(Error, "");
        }
예제 #4
0
        public void ProductNameMin()
        {
            //creates an instance of a class
            clsProduct AProduct = new clsProduct();
            string     Error    = "";
            ////string variable to store any error message
            //String Error = "";

            //create some data for testing with the method

            string ProductName     = "a"; //this should be ok
            string ProductQuantity = "10";
            string ProductPrice    = "10.20";


            //invoke the method

            Error = AProduct.valid(ProductName, ProductQuantity, ProductPrice);
            //test to see the result is correct
            Assert.AreEqual(Error, "");
        }