コード例 #1
0
        public async Task WhenGet_ThenSuccess()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            var room = await _create.StockRoom.BuildAsync();

            var productStatus = await _create.ProductStatus.BuildAsync();

            var product = await _create.Product
                          .WithStatusId(productStatus.Id)
                          .BuildAsync();

            var balanceId = (
                await _create.StockBalance
                .WithRoomId(room.Id)
                .WithProductId(product.Id)
                .WithCount(1)
                .BuildAsync())
                            .Id;

            var balance = await _stockBalancesClient.GetAsync(balanceId, headers);

            Assert.NotNull(balance);
            Assert.Equal(balanceId, balance.Id);
        }
コード例 #2
0
        public async Task <StockBalance> BuildAsync()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            if (_balance.RoomId.IsEmpty())
            {
                throw new InvalidOperationException(nameof(_balance.RoomId));
            }

            if (_balance.ProductId.IsEmpty())
            {
                throw new InvalidOperationException(nameof(_balance.ProductId));
            }

            var id = await _balancesClient.CreateAsync(_balance, headers);

            return(await _balancesClient.GetAsync(id, headers));
        }