Example #1
0
        public async Task post_should_create_report()
        {
            var command = new CreateProductsReport(Guid.Empty, 5);

            var response = await _client.PostAsJsonAsync("reports/products", command);

            response.IsSuccessStatusCode.Should().BeTrue();
            response.Headers.Location.Should().NotBeNull();

            var productResponse = await _client.GetAsync(response.Headers.Location.AbsolutePath);

            var content = await productResponse.Content.ReadAsStringAsync();

            var product = JsonConvert.DeserializeObject <ProductsReportDto>(content);

            product.Products.Should().NotBeEmpty();
        }
Example #2
0
        public async Task <IActionResult> Post(CreateProductsReport command)
        {
            await SendAsync(command.BindId(c => c.Id));

            return(CreatedAtAction(nameof(Get), new { id = command.Id }, null));
        }