public void Not_4_days_Included()
        {
            Domain.Cart target = new Domain.Cart();


            target.AddItem(meal2, DateTime.Now.DayOfWeek);
            target.AddItem(meal3, DateTime.Now.DayOfWeek);

            var result = target.IsValid();

            Assert.False(result);
        }
        public void Can_Clear_Cart()
        {
            Domain.Cart target = new Domain.Cart();


            target.AddItem(meal2, DateTime.Now.DayOfWeek);
            target.AddItem(meal3, DateTime.Now.DayOfWeek);

            target.Clear();

            Assert.Empty(target.Lines);
        }
        public void Can_Add_New_Lines()
        {
            Domain.Cart target = new Domain.Cart();

            target.AddItem(meal1, DateTime.Now.DayOfWeek);
            target.AddItem(meal2, DateTime.Now.DayOfWeek);

            CartLine[] results = target.Lines.ToArray();

            Assert.Equal(2, results.Length);
            Assert.Equal(meal1, results[0].Meal);
            Assert.Equal(meal2, results[1].Meal);
            target.Clear();
        }
        public void Calculate_Cart_Total()
        {
            Domain.Cart target = new Domain.Cart();

            meal2.MealDishes.Add(dish);
            meal2.MealDishes.Add(dish2);
            meal3.MealDishes.Add(dish);
            meal3.MealDishes.Add(dish2);


            target.AddItem(meal2, DateTime.Now.DayOfWeek);
            target.AddItem(meal3, DateTime.Now.DayOfWeek);
            var lines = target.Lines;

            double price = target.ComputeTotalValue(lines);

            Assert.Equal(59.5, price);
        }
        public void Has_BirthDay_Discount()
        {
            Domain.Cart target = new Domain.Cart();
            meal1.MealDishes = new List <Dish>()
            {
                dish, dish2, dish3
            };
            meal2.MealDishes = new List <Dish>()
            {
                dish, dish2, dish3
            };
            meal3.MealDishes = new List <Dish>()
            {
                dish, dish2, dish3
            };

            target.AddItem(meal2, DateTime.Now.DayOfWeek);
            target.AddItem(meal3, DateTime.Now.DayOfWeek);
            target.AddItem(meal1, DateTime.Now.DayOfWeek);

            var    lines = target.Lines;
            double total = target.ComputeTotalValue(lines);

            Assert.Equal((17.85 * 3), total);

            Domain.Client client = new Domain.Client()
            {
                FirstName = "Tester",
                LastName  = "Test",
                Birthday  = DateTime.Now.Date,
                Email     = "*****@*****.**"
            };

            bool sameDate = target.MealOnBirthDay(client.Birthday);

            Assert.True(sameDate);

            if (sameDate)
            {
                total -= MealMethods.GetMealPrice(meal1);
            }

            Assert.Equal(35.7, total);
        }
        public void Can_Delete_Meal_From_Line()
        {
            Domain.Cart target = new Domain.Cart();

            target.AddItem(meal1, DateTime.Now.DayOfWeek);
            target.AddItem(meal2, DateTime.Now.DayOfWeek);
            target.AddItem(meal3, DateTime.Now.DayOfWeek);


            CartLine[] results = target.Lines.ToArray();

            Assert.Equal(3, results.Length);
            Assert.Equal(meal1, results[0].Meal);
            Assert.Equal(meal2, results[1].Meal);
            Assert.Equal(meal3, results[2].Meal);

            target.RemoveLine(meal2);
            Assert.Equal(0, target.Lines.Count(meal => meal.Meal == meal2));
            Assert.Equal(2, target.Lines.Count);
            target.Clear();
        }