//public constructor for the class public clsFoodSupplierCollection() { //var for the index Int32 Index = 0; //var to store the record count Int32 RecordCount = 0; //object for data connection clsDataConnection DB = new clsDataConnection(); //execute the stored procedure DB.Execute("sproc_tblFoodSupplier_SelectAll"); //get the count of records RecordCount = DB.Count; //while there are records to process while (Index < RecordCount) { //create a blank foodpayment clsFoodSupplier AFoodSupplier = new clsFoodSupplier(); //read in the fields from the current record AFoodSupplier.FoodSupplierID = Convert.ToInt32(DB.DataTable.Rows[Index]["FoodSupplierID"]); AFoodSupplier.FoodSupplierName = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierName"]); AFoodSupplier.FoodSupplierAddress = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierAddress"]); AFoodSupplier.FoodSupplierPostCode = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierPostCode"]); AFoodSupplier.FoodSupplierCity = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierCity"]); AFoodSupplier.FoodSupplierCounty = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierCounty"]); AFoodSupplier.FoodSupplierRegion = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierRegion"]); AFoodSupplier.FoodSupplierPhoneNo = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierPhoneNo"]); AFoodSupplier.FoodSupplierMobileNo = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierMobileNo"]); AFoodSupplier.FoodSupplierEmail = Convert.ToString(DB.DataTable.Rows[Index]["FoodSupplierEmail"]); //add the record to the private data member foodSupplierList.Add(AFoodSupplier); //point at the next record Index++; } }
public void InstanceOK() { //create an instance of the we want to create clsFoodSupplier AFoodSupplier = new clsFoodSupplier(); //test to see if this works Assert.IsNotNull(AFoodSupplier); }
public void FoodSupplierCityPropertyOK() { //create an instance of the class we want to create clsFoodSupplier AFoodSupplier = new clsFoodSupplier(); //create some test data to assign to the property string SomeFoodSupplier = "Leicester"; //assign the data to the property AFoodSupplier.FoodSupplierCity = SomeFoodSupplier; //test to see that the two values are the same Assert.AreEqual(AFoodSupplier.FoodSupplierCity, SomeFoodSupplier); }
public void FoodSupplierAddressPropertyOK() { //create an instance of the class we want to create clsFoodSupplier AFoodSupplier = new clsFoodSupplier(); //create some test data to assign to the property string SomeFoodSupplier = "25 Halford Street"; //assign the data to the property AFoodSupplier.FoodSupplierAddress = SomeFoodSupplier; //test to see that the two values are the same Assert.AreEqual(AFoodSupplier.FoodSupplierAddress, SomeFoodSupplier); }
public void FoodSupplierIDPropertyOK() { //create an instance of the class we want to create clsFoodSupplier AFoodSupplier = new clsFoodSupplier(); //create some test data to assign to the property Int32 TestData = 21; //assign the data to the property AFoodSupplier.FoodSupplierID = TestData; //test to see the two values are the same Assert.AreEqual(AFoodSupplier.FoodSupplierID, TestData); }
public void FoodSupplierEmailPropertyOK() { //create an instance of the class we want to create clsFoodSupplier AFoodSupplier = new clsFoodSupplier(); //create some test data to assign to the property string SomeFoodSupplier = "*****@*****.**"; //assign the data to the property AFoodSupplier.FoodSupplierEmail = SomeFoodSupplier; //test to see that the two values are the same Assert.AreEqual(AFoodSupplier.FoodSupplierEmail, SomeFoodSupplier); }
public void FoodSupplierValidMethodOK() { //create an instance of the class we want to create clsFoodSupplier AFoodSupplier = new clsFoodSupplier(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to asisgn to the property string SomeFoodSupplier = "Steak"; //invoke the method OK = AFoodSupplier.Valid(SomeFoodSupplier); //test to see that the result is correct Assert.IsTrue(OK); }