Пример #1
0
        public async Task GetAllOrders_ReturnOkStatus()
        {
            using (var client = new TestClientProvider().Client)
            {
                // Send request to APi endpoint
                var result = await client.GetAsync("api/orders/all");

                // Debug scope to see the object returned
                var orders = await JsonObjectHelper.Deserialize <List <Order> >(result);

                // Assert.Equal("6", orders.Count.ToString());

                Assert.Equal(HttpStatusCode.OK, result.StatusCode);
            }
        }
Пример #2
0
        public async Task GetExistingOrderbyId_And_ReturnOrderObject()
        {
            using (var client = new TestClientProvider().Client)
            {
                // Send request to APi endpoint with Order Id from fixture
                var response = await client.GetAsync("api/orders/" + _fixture.Order.Id);

                // Print to console what product Id was used during the test
                _testOutput.WriteLine($"Order id used for testing: {_fixture.Order.Id}");

                // Deserialize Json object to order object
                var order = await JsonObjectHelper.Deserialize <Order>(response);

                // Assert not null and matching Id's
                Assert.NotNull(order);
                Assert.Equal(_fixture.Order.Id, order.Id);
            }
        }