public void GetModelBuilders_ValidatesParameters() { // Arrange var dbContextType = typeof(CatalogDbContext); var inputBuilders = new IModelBuilder[0]; var service = new ModelBuilderService(inputBuilders); // Act // Assert Assert.Throws <ArgumentNullException>(() => service.GetModelBuilders(null /* dbContextType */, false)); }
public void GetModelBuilders_SupportsUntypedModelBuilders() { // Arrange var dbContextType = typeof(CatalogDbContext); var inputBuilders = new IModelBuilder[] { new UntypedModelBuilder() }; var service = new ModelBuilderService(inputBuilders); // Act var outputBuilders = service.GetModelBuilders(dbContextType, false); // Assert Assert.Equal(1, outputBuilders.Length); Assert.Contains(inputBuilders[0], outputBuilders); }
public void GetModelBuilders_SupportsEntityTypeModelBuilders_FromIListNavigation() { // Arrange var dbContextType = typeof(CatalogDbContext); var inputBuilders = new IModelBuilder[] { new ProductVariantOptionEntityTypeBuilder() }; var service = new ModelBuilderService(inputBuilders); // Act var outputBuilders = service.GetModelBuilders(dbContextType, true /* includeNavigations */); // Assert Assert.Equal(1, outputBuilders.Length); Assert.Contains(inputBuilders[0], outputBuilders); }
public void GetModelBuilders_SupportsEntityTypedModelBuilders_FromDbSetProperties() { // Arrange var dbContextType = typeof(CatalogDbContext); var inputBuilders = new IModelBuilder[] { new ProductEntityTypeBuilder(), new ProductVariantEntityTypeBuilder(), new VendorEntityTypeBuilder(), new AttributeEntityTypeBuilder() }; var service = new ModelBuilderService(inputBuilders); // Act var outputBuilders = service.GetModelBuilders(dbContextType, false /* includeNavigations */); // Assert Assert.Equal(3, outputBuilders.Length); Assert.Contains(inputBuilders[0], outputBuilders); Assert.Contains(inputBuilders[1], outputBuilders); Assert.Contains(inputBuilders[2], outputBuilders); }