Beispiel #1
0
        public void SetUp()
        {
            _orderRepository = new Mock <IOrderRepository>();
            _orderRepository.Setup(x => x.GetBasketById(It.IsAny <int>())).Returns(() => new Data.Order.GetBasketByIdResponse
            {
                BasketDetails = new BasketDetails
                {
                    Total = Money.From(1200)
                }
            });

            var subject = new BasketService(_orderRepository.Object, null, null);

            _result = subject.GetBasketById(1);
        }
Beispiel #2
0
        public GetBasketByIdResponse GetBasketById(int basketId)
        {
            var response = new GetBasketByIdResponse();

            var getBasketByIdResponse = _orderRepository.GetBasketById(basketId);

            if (getBasketByIdResponse.HasError)
            {
                response.AddError(getBasketByIdResponse.Error);
                return(response);
            }

            response.Basket = getBasketByIdResponse.BasketDetails;
            return(response);
        }