public async Task GetBrandByIdAsyncShouldReturnBrandUpdateDtoModel() { brandRepository.Setup(r => r.All()).Returns(brandsAll.AsQueryable()); var service = new BrandService(brandRepository.Object); var result = await service.GetBrandByIdAsync(1); var expected = "BrandUpdateDtoModel"; var actual = result.GetType().Name; Assert.Equal(expected, actual); }
public async Task GetBrandById_ShouldReturnBrandByBrandId() { var options = new DbContextOptionsBuilder <TechAndToolsDbContext>() .UseInMemoryDatabase(databaseName: "GetBrandById_ShouldReturnBrandByBrandId") .Options; TechAndToolsDbContext context = new TechAndToolsDbContext(options); await SeedData(context); IBrandService brandService = new BrandService(context); int brandId = 1; BrandServiceModel actualData = await brandService.GetBrandByIdAsync(brandId); Assert.NotNull(actualData); Assert.Equal(brandId, actualData.Id); }