コード例 #1
0
 public void TestGetProductOptionByIdNotFound()
 {
     using (var context = new ProductDbContext(builder.Options))
     {
         SetUpTestData(context);
         IProductOptionRepository productOptionRepository = new ProductOptionRepository(context);
         ProductOption            po = productOptionRepository.GetById(new Guid());
         po.Should().BeNull();
         context.Database.EnsureDeleted();
     }
 }
コード例 #2
0
 public void TestGetProductOptionByIdOK()
 {
     using (var context = new ProductDbContext(builder.Options))
     {
         SetUpTestData(context);
         IProductOptionRepository productOptionRepository = new ProductOptionRepository(context);
         ProductOption            po = productOptionRepository.GetById(productOptions[0].Id);
         po.Should().NotBeNull();
         po.Id.Should().Equals(productOptions[0].Id);
         po.Name.Should().Equals(productOptions[0].Name);
         po.Description.Should().Equals(productOptions[0].Description);
         po.ProductId.Should().Equals(productOptions[0].ProductId);
         context.Database.EnsureDeleted();
     }
 }