public async Task Create_ShouldReturnsSuccessResult()
        {
            var client = factory.GetHttpClient();

            var request = new CreateProduct.CreateProductCommand()
            {
                CategoryId = 1,
                ShopId     = 1,
                Name       = "TestProduct",
                Vendor     = "Factory",
                BasePrice  = new BasePriceDto {
                    Price = 100
                }
            };

            var response = await client.PostAsJsonAsync("/api/products/", request);

            response.EnsureSuccessStatusCode();

            var responseString = await response.Content.ReadAsStringAsync();

            var result = JsonConvert.DeserializeObject <int>(responseString);

            result.Should().BeGreaterThan(0);

            response.StatusCode.Should().Be(HttpStatusCode.Created);
            response.Headers.Location.LocalPath.Should().Be($"/api/Products/{result}");
        }
        public async Task Create_ShouldFailIfRequestIsNotValid()
        {
            var client = factory.GetHttpClient();

            var request = new CreateProduct.CreateProductCommand()
            {
                Name = "TestProduct"
            };

            var response = await client.PostAsJsonAsync("/api/products/", request);

            var responseString = await response.Content.ReadAsStringAsync();

            var result = JsonConvert.DeserializeObject <IEnumerable <string> >(responseString);

            response.StatusCode.Should().Be(HttpStatusCode.BadRequest);
            result.Should().NotBeNullOrEmpty();
        }
        public async Task <ActionResult <int> > Create([FromBody] CreateProduct.CreateProductCommand createCommand)
        {
            var response = await Mediator.Send(createCommand);

            return(CreatedAtAction(nameof(GetProductDetails), new { id = response }, response));
        }