Exemple #1
0
        public void TestSplitDishesWithSuccess()
        {
            using (var context = _serviceProvider.GetService <RestaurantOrderContext>())
            {
                var repo    = new ClientOrderHistoryRepository(context);
                var service = new RestaurantOrderAppService(repo, _mapper);

                var inputOrderDto = new InputOrderDto();
                inputOrderDto.ClientOrderInput = "morning, 1, 2, 3, 3, 3";

                var expectedResponse   = new OrderSplitedDto();
                var expectedListDishes = new List <string>();
                expectedListDishes.Add(" 1");
                expectedListDishes.Add(" 2");
                expectedListDishes.Add(" 3");
                expectedListDishes.Add(" 3");
                expectedListDishes.Add(" 3");

                expectedResponse.DayPeriod  = DayPeriodEnum.morning;
                expectedResponse.DishesList = expectedListDishes;

                var response = service.SeparatePeriodFromDishes(inputOrderDto);

                Assert.Equal(expectedListDishes, response.DishesList);
            }
        }
Exemple #2
0
        public void TestSplitDishesWithError()
        {
            using (var context = _serviceProvider.GetService <RestaurantOrderContext>())
            {
                var repo    = new ClientOrderHistoryRepository(context);
                var service = new RestaurantOrderAppService(repo, _mapper);

                var inputOrderDto = new InputOrderDto();
                inputOrderDto.ClientOrderInput = "afternoon, 1, 2, 3, 3, 3";

                var response = service.SeparatePeriodFromDishes(inputOrderDto);

                Assert.Null(response);
            }
        }
Exemple #3
0
        public void TestCreateOrderOutputWithError()
        {
            using (var context = _serviceProvider.GetService <RestaurantOrderContext>())
            {
                var repo    = new ClientOrderHistoryRepository(context);
                var service = new RestaurantOrderAppService(repo, _mapper);
                var input   = "night, 1, 1";

                var orderSplitedDto = new OrderSplitedDto();
                var listDishes      = new List <string>();
                listDishes.Add("1");
                listDishes.Add("1");
                orderSplitedDto.DayPeriod  = DayPeriodEnum.night;
                orderSplitedDto.DishesList = listDishes;

                var response = service.CreateOrderOutput(orderSplitedDto, input);

                Assert.Equal("steak, error", response.ClientOrderOutput);
            }
        }