Exemplo n.º 1
0
        public async Task GetAllOrders_Returns_Ok()
        {
            using (var client = new TestClientProvider().Client)
            {
                var response = await client.GetAsync("/api/order/getall");

                response.EnsureSuccessStatusCode();

                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            }
        }
Exemplo n.º 2
0
        public async Task GetOrderById_Returns_Order()
        {
            using (var client = new TestClientProvider().Client)
            {
                var OrderResponse = await client.GetAsync($"/api/order/getbyid/{_fixture.order.Id}");

                using (var responseStream = await OrderResponse.Content.ReadAsStreamAsync())
                {
                    var order = await JsonSerializer.DeserializeAsync <Order>(responseStream,
                                                                              new JsonSerializerOptions()
                    {
                        PropertyNameCaseInsensitive = true
                    });

                    Assert.Equal(_fixture.order.Id, order.Id);
                }
            }
        }