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); }
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); }
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); }
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, ""); }
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); }
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, ""); }
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); }
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); }