public void TestGetProductOptionByProductIdNotFound() { using (var context = new ProductDbContext(builder.Options)) { SetUpTestData(context); IProductOptionRepository productOptionRepository = new ProductOptionRepository(context); var p = productOptionRepository.GetProductOptionsByProductId(new Guid()); p.Result.Should().BeEmpty(); context.Database.EnsureDeleted(); } }
public void TestGetProductOptionByProductIdOK() { using (var context = new ProductDbContext(builder.Options)) { SetUpTestData(context); IProductOptionRepository productOptionRepository = new ProductOptionRepository(context); var po = productOptionRepository.GetProductOptionsByProductId(products[0].Id); po.Result.Should().NotBeEmpty(); po.Result.Should().HaveCount(1); ProductOption prodOpt = po.Result[0]; prodOpt.Id.Should().Equals(productOptions[0].Id); prodOpt.Name.Should().Equals(productOptions[0].Name); prodOpt.Description.Should().Equals(productOptions[0].Description); prodOpt.ProductId.Should().Equals(products[0].Id); context.Database.EnsureDeleted(); } }