Esempio n. 1
0
        public async Task <Order> BuildAsync()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            if (_order.TypeId.IsEmpty())
            {
                throw new InvalidOperationException(nameof(_order.TypeId));
            }

            if (_order.StatusId.IsEmpty())
            {
                throw new InvalidOperationException(nameof(_order.StatusId));
            }

            var id = await _ordersClient.CreateAsync(_order, headers);

            return(await _ordersClient.GetAsync(id, headers));
        }
Esempio n. 2
0
        public async Task WhenGet_ThenSuccess()
        {
            var headers = await _defaultRequestHeadersService.GetAsync();

            var type = await _create.OrderType.BuildAsync();

            var status = await _create.OrderStatus.BuildAsync();

            var orderId = (
                await _create.Order
                .WithTypeId(type.Id)
                .WithStatusId(status.Id)
                .BuildAsync())
                          .Id;

            var order = await _ordersClient.GetAsync(orderId, headers);

            Assert.NotNull(order);
            Assert.Equal(orderId, order.Id);
        }