Exemple #1
0
        public async Task Must_Update()
        {
            var category = CategoryGenerator.GenerateAndSave(CategoryRepository);

            Command.Id = category.Id;

            var response = await HttpClient.PutAsJsonAsync($"{BasePath}Categories", Command);

            Output.WriteLine(await response.Content.ReadAsStringAsync());
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);

            category = CategoryRepository.Reload(category);
            Assert.Equal(Command.Id, category.Id);
            Assert.Equal(Command.Title, category.Title);
        }
Exemple #2
0
        public ProductTest
        (
            TestWebApplicationFactory factory,
            ITestOutputHelper output
        ) : base(factory, output)
        {
            var category = CategoryGenerator.GenerateAndSave(CategoryRepository);

            Command = new ProductCreateCommand
            {
                Title       = "Product Title",
                Description = "Product description",
                Price       = 150,
                Quantity    = 10,
                CategoryId  = category.Id
            };
        }