Exemplo n.º 1
0
        public void InstanceOK()
        {
            //create an instance of the class we want to create
            ClsClothes ClothingItem = new ClsClothes();

            //test to see that it exists
            Assert.IsNotNull(ClothingItem);
        }
Exemplo n.º 2
0
        public void ProductNo()
        {
            //create an instance of the class we want to create
            ClsClothes ClothingItem = new ClsClothes();
            //Create some test data to assign to the property
            Int32 TestData = 1;

            //assign the data to the property
            ClothingItem.ProductNo = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ClothingItem.ProductNo, TestData);
        }
Exemplo n.º 3
0
        public void ClothesName()
        {
            //create an instance of the class we want to create
            ClsClothes ClothingItem = new ClsClothes();
            //Create some test data to assign to the property
            string TestData = "White T Shirt";

            //assign the data to the property
            ClothingItem.ClothesName = TestData;
            //test to see that the two values are the same
            Assert.AreEqual(ClothingItem.ClothesName, TestData);
        }
Exemplo n.º 4
0
        public void ClothesNameMinPlusOne()
        {
            //create an instance of the class we want to create
            ClsClothes ClothingItem = new ClsClothes();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //Create some test data to pass to the method
            string ClothesDescription = "Small White T Shirt";
            string ClothesName        = "White T Shirt";
            string ClothesCost        = "1";

            //invoke the method
            OK = ClothingItem.Valid(ClothesDescription, ClothesName, ClothesCost);
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }
Exemplo n.º 5
0
        public void FindMethod()
        {
            //create an instance of the class we want to create
            ClsClothes ClothingItem = new ClsClothes();

            ClothingItem.Find(2);
            string ClothesName = ClothingItem.ClothesName;
            //boolean variable to store the result of the validation
            Boolean Found = false;
            // create some test data to use with the method
            Int32 ProductNo = 1;

            //invoke the method
            Found = ClothingItem.Find(ProductNo);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
Exemplo n.º 6
0
        public void ClothesDescriptionExtremeMax()
        {
            //create an instance of the class we want to create
            ClsClothes ClothingItem = new ClsClothes();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //Create some test data to pass to the method
            string ClothesDescription = "";

            ClothesDescription = ClothesDescription.PadRight(500, 'a');// This should tigger an error
            string ClothesName = "White T Shirt";
            string ClothesCost = "1";

            //invoke the method
            OK = ClothingItem.Valid(ClothesDescription, ClothesName, ClothesCost);
            //test to see that the result is correct
            Assert.IsFalse(OK);
        }
Exemplo n.º 7
0
        public void TestProductNoFound()
        {
            //create an instance of the class we want to create
            ClsClothes ClothingItem = new ClsClothes();
            //boolean variable to store the result of the search
            Boolean Found = false;
            //boolean variable to record if data is ok
            Boolean OK = true;
            //create some test data to use with the method
            Int32 ProductNo = 1;

            //invoke the method
            Found = ClothingItem.Find(ProductNo);
            //check the Product no
            if (ClothingItem.ProductNo != 1)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }