Example #1
0
        public void CanOrderMeal()
        {
            bool result = false;

            Meal m = new Meal("Toast", "Butter", 1);

            OrderManager.AddMeal(m);

            // If the user has items in the cart then they can place the order else return false
            if (OrderManager.Meals != null && OrderManager.Meals.Count > 0 && NetworkConnectionTrigger.HasInternet())
            {
                result = true;
            }

            Assert.AreEqual(true, result);
        }
Example #2
0
        /// <summary>
        /// Checks whether or not the user can place the order
        /// </summary>
        /// <returns>If user can place order</returns>
        private string CanOrder()
        {
            // If the user has items in the cart then they can place the order else return false
            if (OrderManager.Meals == null)
            {
                return("You must have at least one meal in the cart");
            }
            else if (OrderManager.Meals.Count < 1)
            {
                return("You must have at least one meal in the cart");
            }

            // Whether or not the user has an internet connection
            if (NetworkConnectionTrigger.HasInternet())
            {
                return("Success");
            }
            else
            {
                return("You must be connected to the internet");
            }
        }