Exemple #1
0
        public void ValidMethodOK()
        {
            //create an instace of the class
            clsProducts AProduct = new clsProducts();
            //string variable to store error message
            String Error = "";

            //invoke the method
            Error = AProduct.Valid(ProductID, ProductName, Price, Quantity);
            //test if result is correct
            Assert.AreEqual(Error, "");
        }
Exemple #2
0
        public void QuantityMid()
        {
            //create an instace of the class
            clsProducts AProduct = new clsProducts();
            //string variable to store error
            string Error = "";
            //create test data to pass to the method
            string Quantity = "111"; //this will pass

            //invoke the method
            Error = AProduct.Valid(ProductID, ProductName, Price, Quantity);
            //test if result is correct
            Assert.AreEqual(Error, "");
        }
Exemple #3
0
        public void ProductIDMinMinusOne()
        {
            //create an instace of the class
            clsProducts AProduct = new clsProducts();
            //string variable to store error message
            String Error = "";
            //create test data to pass to method
            string ProductID = ""; //this will trigger error

            //invoke the method
            Error = AProduct.Valid(ProductID, ProductName, Price, Quantity);
            //test if result is correct
            Assert.AreNotEqual(Error, "");
        }
Exemple #4
0
        public void QuantityExtremeMax()
        {
            //create an instace of the class
            clsProducts AProduct = new clsProducts();
            //string variable to store error
            string Error = "";
            //create test data to pass to the method
            string Quantity = ""; //this will fail

            Quantity = Quantity.PadRight(500, '1');
            //invoke the method
            Error = AProduct.Valid(ProductID, ProductName, Price, Quantity);
            //test if result is correct
            Assert.AreNotEqual(Error, "");
        }
Exemple #5
0
        public void ProductNameMaxMinusOne()
        {
            //create an instace of the class
            clsProducts AProduct = new clsProducts();
            //string variable to store error
            string Error = "";
            //create test data to pass to the method
            string ProductName = ""; //this will pass

            ProductName = ProductName.PadRight(19, 'a');
            //invoke the method
            Error = AProduct.Valid(ProductID, ProductName, Price, Quantity);
            //test if result is correct
            Assert.AreEqual(Error, "");
        }