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); }
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); }