Esempio n. 1
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();

            //test to see that it exists
            Assert.IsNotNull(AProduct);
        }
Esempio n. 2
0
        public void ProductPriceOK()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();
            //create some test data to assign to the product
            string TestData = "£40.00";

            //assign the data to the product
            AProduct.Price = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AProduct.Price, TestData);
        }
Esempio n. 3
0
        public void ProductDescriptionOK()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();
            //create some test data to assign to the product
            string TestData = "Medium, black";

            //assign the data to the product
            AProduct.Description = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AProduct.Description, TestData);
        }
Esempio n. 4
0
        public void ValidMethod()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();
            //string variable to store any error message
            String Error = "";

            //invoke the method
            Error = AProduct.Valid(Name, Price, Description);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 5
0
        public void StockProductOK()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();
            //create some test data to assign to the product
            Boolean TestData = true;

            //assign the data to the product
            AProduct.Stock = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(AProduct.Stock, TestData);
        }
Esempio n. 6
0
        public void DescriptionMid()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            //this should pass
            string Description = "";

            Description = Description.PadRight(25, 'a');
            //invoke the method
            Error = AProduct.Valid(Name, Price, Description);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
Esempio n. 7
0
        public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();
            //bollean variable to store the results of the validation
            Boolean found = false;
            //create some text data to use with method


            Int32 ProductID = 1;

            Int32 ProductID = 1;

            Int32 ProductID = 1;

            //invoke the mehtod
            found = AProduct.Find(ProductID);
            //test to see if the results is true
            Assert.IsTrue(found);
        }
Esempio n. 8
0
        public void TestDescriptionFound()
        {
            //create an instance of the class we want to create
            clsProduct AProduct = new clsProduct();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is)
            Boolean OK = true;
            //create some test data to use with the method


            Int32 ProductID = 2;

            //invoke the mehtod
            Found = AProduct.Find(ProductID);
            //check the Product Description
            if (AProduct.Description != "Grey, Medium")
            {
                Int32 ProductID = 2;
            }
            //invoke the mehtod
            Found = AProduct.Find(ProductID);
            //check the address no
            if (AProduct.Description != "Grey, Medium")
            {
                Int32 ProductID = 2;
            }
            //invoke the mehtod
            Found = AProduct.Find(ProductID);
            //check the Product Description
            if (AProduct.Description != "Grey, Medium")

            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }