public void AddMethodOK() { //create an instance of the class we want to create clsFoodCollection AllFood = new clsFoodCollection(); //create the item of the test data clsFood TestItem = new clsFood(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.FoodID = "1"; TestItem.FoodName = "Steak"; TestItem.FoodPrice = "£20"; TestItem.Quantity = "2"; //set ThisAddress to the test data AllFood.ThisFood = TestItem; //add the record PrimaryKey = AllFood.Add(); //set the primary key of the test data TestItem.FoodID = PrimaryKey; //find the record AllFood.ThisFood.Find(PrimaryKey); //test to see that the two values are the same Assert.AreEqual(AllFood.ThisFood, TestItem); }
public void DeleteMethodOK() { //create an instance of the class we want to create clsFoodCollection AllFood = new clsFoodCollection(); //create the item of the test data clsFood TestItem = new clsFood(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.FoodID = "1"; TestItem.FoodName = "Steak"; TestItem.FoodPrice = "£20"; TestItem.Quantity = "2"; //set ThisAddress to the test data AllFood.ThisFood = TestItem; TestItem.FoodID = PrimaryKey; //find the record AllFood.ThisFood.Find(PrimaryKey); //delete the record AllFood.Delete(); //now find the record Boolean Found = AllFood.ThisFood.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void InstanceOK() { //create an instance of the we want to create clsFood AFood = new clsFood(); //test to see if this works Assert.IsNotNull(AFood); }
public void FoodQuantityPropertyOK() { //create an instance of the class we want to create clsFood AFood = new clsFood(); //create some test data to assign to the property string SomeFood = "Steak"; //assign the data to the property AFood.Quantity = SomeFood; //test to see that the two values are the same Assert.AreEqual(AFood.Quantity, SomeFood); }
public void FoodIDPropertyOK() { //create an instance of the class we want to create clsFood AFood = new clsFood(); //create some test data to assign to the property Int32 TestData = 21; //assign the data to the property AFood.FoodID = TestData; //test to see the two values are the same Assert.AreEqual(AFood.FoodID, TestData); }
public void FoodValidMethodOK() { //create an instance of the class we want to create clsFood AFood = new clsFood(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to asisgn to the property string SomeFood = "Steak"; //invoke the method OK = AFood.Valid(SomeFood); //test to see that the result is correct Assert.IsTrue(OK); }
public void ThisFoodPropertyOK() { //create an instance of the class we want to create clsFoodCollection AllFood = new clsFoodCollection(); //create some test data to assign to the property clsFood TestClient = new clsFood(); //set the properties of the test object TestItem.FoodID = "1"; TestItem.FoodName = "Steak"; TestItem.FoodPrice = "£20"; TestItem.Quantity = "2"; //assign the data to the property AllFood.ThisFood = TestFood; //test to see that the two values are the same Assert.AreEqual(AllFood.ThisFood, TestFood); }
public void ListAndCountOK() { //create an instance of the class we want to create clsFoodCollection AllFood = new clsFoodCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsFood> TestList = new List <clsFood>(); //add an item to the list //create the item of the test data clsFood TestItem = new clsFood(); //set its properties TestItem.FoodID = "1"; TestItem.FoodName = "Steak"; TestItem.FoodPrice = "£20"; TestItem.Quantity = "2"; //add the item to the item test list TestList.Add(TestItem); //assign the data to the property AllFood.FoodList = TestList; //test to see that the two values are the same Assert.AreEqual(AllFood.Count, TestList.Count); }