Esempio n. 1
0
        public async Task PostBrand_Success()
        {
            var brand = new BrandCreateRequest {
                Name = "Test brand"
            };

            var controller = new BrandsController(_applicationDbContex);
            var result     = await controller.PostBrand(brand);

            var createdAtActionResult = Assert.IsType <CreatedAtActionResult>(result.Result);
            var returnValue           = Assert.IsType <BrandVm>(createdAtActionResult.Value);

            Assert.Equal("Test brand", returnValue.Name);
        }
Esempio n. 2
0
        public async Task ValidatePostBrand()
        {
            var brand = new BrandCreateRequest()
            {
                Name = "GOG.com"
            };

            var controller = new BrandsController(_dbContext);
            var result     = await controller.PostBrand(brand);

            var createdAtActionResult = Assert.IsType <CreatedAtActionResult>(result.Result);
            var returnValue           = Assert.IsType <BrandVm>(createdAtActionResult.Value);

            Assert.Equal("GOG.com", returnValue.Name);
        }