Example #1
0
 /// <summary>
 /// Initializes an instance of <see cref="CafeCardWidgetViewComponent"/> class.
 /// </summary>
 public CafeCardWidgetViewComponent(
     IPageAttachmentUrlRetriever attachmentUrlRetriever,
     CafeRepository repository)
 {
     this.attachmentUrlRetriever = attachmentUrlRetriever;
     this.repository             = repository;
 }
Example #2
0
        public void TestShowAll()
        {
            CafeRepository cafeRepository = new CafeRepository();

            cafeRepository.AddMenuItem();
            cafeRepository.ShowAllItems();
        }
Example #3
0
        public void DeleteExistingMenu_ShouldReturnTrue()
        {
            Menu           content      = new Menu();
            MenuItem       menuContent  = new MenuItem();
            CafeRepository repository   = new CafeRepository();
            bool           removeResult = repository.DeleteMenuItem(menuContent.MealNumber);

            Assert.IsTrue(removeResult);
        }
Example #4
0
        public void UpdateExistingMenu_ShouldReturnTrue()
        {
            Menu           content       = new Menu();
            MenuItem       menuContent   = new MenuItem();
            CafeRepository repository    = new CafeRepository();
            bool           updateResults = repository.EditMenuItem(menuContent);

            Assert.IsTrue(updateResults);
        }
Example #5
0
 public ContactsController(ContactRepository contactRepository,
                           CountryRepository countryRepository,
                           CafeRepository cafeRepository,
                           IStringLocalizer <SharedResources> localizer)
 {
     this.countryRepository = countryRepository;
     this.contactRepository = contactRepository;
     this.cafeRepository    = cafeRepository;
     this.localizer         = localizer;
 }
Example #6
0
        public void Arrange()
        {
            _repo = new CafeRepository();

            //add a menu item
            _content = new CafeContent("Hamburger", "Meat in between two buns with some toppings", "Meat, bread, lettuce", 1, 2.50);

            //add movie to database
            _repo.AddItemToMenu(_content);
        }
Example #7
0
        public void AddToMenu_ShouldGetCorrectBoolean()
        {
            Menu           content     = new Menu();
            MenuItem       menuContent = new MenuItem();
            CafeRepository repository  = new CafeRepository();

            bool addResult = repository.AddMenuItems(menuContent);

            Assert.IsTrue(addResult);
        }
        public void TestMethod1()
        {
            CafeRepository MyTest = new CafeRepository();
            string         check1 = MyTest.CreateDataBase("", "", "", "", "");
            string         check2 = MyTest.ReadFromDataBase();
            string         check3 = MyTest.DeleteDataBase();

            Assert.IsNotNull(check1);
            Assert.AreEqual("read", check2);
            Assert.AreEqual("deleted", check3);
        }
Example #9
0
        public void AddMenuItemTest()
        {
            //arrange
            CafeContent    item       = new CafeContent();
            CafeRepository repository = new CafeRepository();

            //act
            bool addItem = repository.AddItemToMenu(item);

            //assert
            Assert.IsTrue(addItem);
        }
Example #10
0
 public CafesController(IPageDataContextRetriever dataContextRetriever,
                        CafeRepository cafeRepository,
                        CountryRepository countryRepository,
                        IStringLocalizer <SharedResources> localizer,
                        IPageAttachmentUrlRetriever attachmentUrlRetriever)
 {
     this.dataContextRetriever   = dataContextRetriever;
     this.cafeRepository         = cafeRepository;
     this.countryRepository      = countryRepository;
     this.localizer              = localizer;
     this.attachmentUrlRetriever = attachmentUrlRetriever;
 }
        //Testing the Create method
        public void AddMealToDir_ShouldGetCorrectBoolean()
        {
            //Arrange, Act, Assert
            //Arrange -> Overall Setup
            Menu           menu       = new Menu();
            CafeRepository repository = new CafeRepository();
            //Act -> Get/Run the code to test
            bool addResult = repository.AddMealToDirectory(menu);

            //Assert -> Get expected outcome of the test
            Assert.IsTrue(addResult);
        }
Example #12
0
        public void AddToMenu_ShouldGetCorrectBoolean()
        {
            //Arrange
            MenuItem       content = new MenuItem();
            CafeRepository repo    = new CafeRepository();

            //Act
            bool addResult = repo.AddMealToMenu(content);

            // Assert
            Assert.IsTrue(addResult);
        }
 public void Arrange()
 {
     _repo = new CafeRepository();
     _meal = new Menu(1, "Hamburger\n", "Fresh never frozen beef on a sesame seed bun with fries\n",
                      "Sesame Seed Bun\n " +
                      "Beef Patty\n" +
                      "Lettuce\n" +
                      "Tomato\n" +
                      "Onions" +
                      "Ketchup\n",
                      5.00m);
     _repo.AddMealToDirectory(_meal);
 }
Example #14
0
        public void GetContents_ShouldReturnCorrectCollection()
        {
            //Arrange
            MenuItem       content = new MenuItem();
            CafeRepository repo    = new CafeRepository();

            repo.AddMealToMenu(content);
            //Act
            List <MenuItem> contents            = repo.GetContents();
            bool            directoryHasContent = contents.Contains(content);

            //Assert
            Assert.IsTrue(directoryHasContent);
        }
        //testing the read method
        public void GetMeal_ShouldReturnCorrectCollection()
        {
            //arrange
            //creating the menu
            Menu menu = new Menu();
            //creating the repo
            CafeRepository repository = new CafeRepository();

            //adding to the repo(menu)
            repository.AddMealToDirectory(menu);
            //act
            //store list of meals w/n a variable
            List <Menu> menuList = repository.ViewFullMenu();
            //looks through our entire list and returns true if there is content
            bool directoryHasMeals = menuList.Contains(menu);

            //assert
            Assert.IsTrue(directoryHasMeals);
        }
        //Create new menu item
        private void CreateNewItem()
        {
            Console.Clear();

            Cafe           newItem = new Cafe();
            CafeRepository menu    = new CafeRepository();

            //Meal Number

            Console.WriteLine("Please enter the item/meal number:");

            string input = Console.ReadLine();
            int    number;
            bool   isNumber = Int32.TryParse(input, out number);

            if (isNumber == true)
            {
                newItem.MealNumber = number;
            }
            else
            {
                Console.WriteLine("Please input a valid number\n" +
                                  "Press any key to continue");
                Console.ReadKey();
                CreateNewItem();
            }

            //Meal Name
            Console.WriteLine("Please enter the item/meal name:");
            string nameInput = Console.ReadLine().ToLower();

            if (nameInput != null)
            {
                newItem.MealName = nameInput;
            }
            else
            {
                Console.WriteLine("Please input a valid name\n" +
                                  "Press any key to continue");
                Console.ReadKey();
                CreateNewItem();
            }

            //Meal Description
            Console.WriteLine("Please enter the item/meal description:");
            newItem.Description = Console.ReadLine().ToLower();
            //Meal Ingredients
            Console.WriteLine("Please enter the item/meal ingredients:");
            string ingredients = Console.ReadLine();

            newItem.AddIngredients(ingredients);
            //Meal Price
            Console.WriteLine("Please enter the item/meal price:");

            string priceInput = Console.ReadLine();

            double priceNumber;
            bool   isItNumber = double.TryParse(priceInput, out priceNumber);

            if (isItNumber == true)
            {
                newItem.Price = priceNumber;
            }
            else
            {
                Console.WriteLine("Please input a valid number\n" +
                                  "Press any key to continue");
                Console.ReadKey();
            }
            _menuRepo.AddMenuItems(newItem);

            Menu();
        }
Example #17
0
 public void Arrange()
 {
     _repo    = new CafeRepository();
     _content = new MenuItem(1, "Meatloaf", "Savory meatloaf and mashed potatoes", "Ground sirloin, eggs, ketchup, potatoes, milk, butter", 5.99);
     _repo.AddMealToMenu(_content);
 }
 public void Arrange()
 {
     _cafeRepo    = new CafeRepository();
     _cafeContent = new CafeMenu(11, "Pancakes", "Fluffy and Good", "Water, Milk, Eggs, Panckae Stuff", 10.88d);
 }
 public void Arrange()
 {
     _cafeRepository = new CafeRepository();
     _menuItem       = new MenuItem(1, "The Big One", "It's a real big one", "There's one and it's big", 1.00m);
     _cafeRepository.AddItemtoMenu(_menuItem);
 }