Example #1
0
        public void AddAsync_CreatesNewDetails_WhenNotExists()
        {
            var testGameDto = new GameDto();

            A.CallTo(() => _gameService.GetByKeyAsync(A <string> ._, Culture)).Returns(testGameDto);
            A.CallTo(() => _orderDetailsService.FindSingleAsync(A <Expression <Func <OrderDetails, bool> > > ._))
            .Returns((OrderDetails)null);

            _basketService.AddAsync(GameKey, CustomerId);

            A.CallTo(() => _orderDetailsService.CreateAsync(A <OrderDetailsDto> ._)).MustHaveHappenedOnceExactly();
        }
        public void FindSingleAsync_CallsRepository_Always()
        {
            Expression <Func <OrderDetails, bool> > expression = od => true;

            _orderDetailsService.FindSingleAsync(expression);

            A.CallTo(() => _orderDetailsDecorator.FindSingleAsync(expression)).MustHaveHappenedOnceExactly();
        }
Example #3
0
        private async Task <OrderDetails> GetDetailsByGameKeyAndCustomerIdAsync(string gameKey, string customerId)
        {
            Expression <Func <OrderDetails, bool> > existingNewOrderFilter = od =>
                                                                             od.GameRoot.Key == gameKey && od.Order.UserId == customerId && od.Order.State <= OrderState.Ordered;
            var existingDetails = await _orderDetailsService.FindSingleAsync(existingNewOrderFilter);

            return(existingDetails);
        }