示例#1
0
        public void AddToListNull()
        {
            // Arrange
            CafeLibrary data = new CafeLibrary();

            data.MealNumber = 1;
            CafeRepo repository = new CafeRepo();

            // Act
            repository.AddDatatoMenu(data);
            CafeLibrary dataFromDir = repository.GetDataWithMealNumber(1);

            // Assert
            Assert.IsNotNull(dataFromDir);
        }
        // #3 Delete Data
        private void DisplaybyMealNumber()
        {
            Console.Clear();
            Console.WriteLine("Enter meal number to remove");

            string      mealNumber = Console.ReadLine();
            int         result     = Convert.ToInt32(mealNumber);
            CafeLibrary data       = _dataRepo.GetDataWithMealNumber(result);

            if (data != null)
            {
                Console.WriteLine($"Title: {data.MealName},\n" +
                                  $"Description: {data.Description},\n" +
                                  $"Ingredients: {data.Ingredients},\n" +
                                  $"Price: {data.Price}");
            }
            else
            {
                Console.WriteLine("That Item is Not Available. Please Make Another Selection ");
            }
        }