//public constructor for the class
        public clsFoodOrderingCollection()
        {
            //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_tblFoodOrdering_SelectAll");
            //get the count of records
            RecordCount = DB.Count;
            //while there are records to process
            while (Index < RecordCount)
            {
                //create a blank address
                clsFoodOrdering AFoodOrdering = new clsFoodOrdering();
                //read in the fields from the current record
                AFoodOrdering.FoodOrderingID = Convert.ToInt32(DB.DataTable.Rows[Index]["FoodOrderingID"]);
                AFoodOrdering.RestaurantID   = Convert.ToInt32(DB.DataTable.Rows[Index]["RestaurantID"]);
                //add the record to the private data member
                foodOrderingList.Add(AFoodOrdering);
                //point at the next record
                Index++;
            }
        }
Exemple #2
0
        public void FoodOrderingInstanceOK()
        {
            //create an instance of the class we want to create
            clsFoodOrdering AFoodOrdering = new clsFoodOrdering();

            //test to see if the data works
            Assert.IsNotNull(AFoodOrdering);
        }
Exemple #3
0
        public void RestaurantIDPropertyOK()
        {
            //create an instance of the class we want to create
            clsFoodOrdering AFoodOrdering = new clsFoodOrdering();
            //create some test data to assign to the property
            Int32 TestData = 21;

            //assign the data to the property
            AFoodOrdering.RestaurantID = TestData;
            //test to see the two values are the same
            Assert.AreEqual(AFoodOrdering.RestaurantID, TestData);
        }
Exemple #4
0
        public void FoodOrderingValidMethodOK()
        {
            //create an instance of the class we want to create
            clsFoodOrdering AFood = new clsFoodOrdering();
            //boolean variable to store the result of the validation
            Boolean OK = false;
            //create some test data to asisgn to the property
            string SomeFoodOrdering = "Order 1";

            //invoke the method
            OK = AFood.Valid(SomeFoodOrdering);
            //test to see that the result is correct
            Assert.IsTrue(OK);
        }