public void Adds_all_entities_based_on_all_distinct_entity_types_found() { var setFinder = new FakeSetFinder(); var model = CreateDefaultModelSource(setFinder) .GetModel(InMemoryTestHelpers.Instance.CreateContext(), _nullConventionSetBuilder, _coreModelValidator); Assert.Equal( new[] { typeof(SetA).DisplayName(), typeof(SetB).DisplayName() }, model.GetEntityTypes().Select(e => e.Name).ToArray()); }
public void Adds_all_entities_based_on_all_distinct_entity_types_found() { var setFinder = new FakeSetFinder(); var loggers = new DiagnosticsLoggers( new TestLogger <DbLoggerCategory.Model, TestLoggingDefinitions>(), new TestLogger <DbLoggerCategory.Model.Validation, TestLoggingDefinitions>()); var model = CreateDefaultModelSource(setFinder) .GetModel(InMemoryTestHelpers.Instance.CreateContext(), _nullConventionSetBuilder, new FakeModelValidator(), loggers); Assert.Equal( new[] { typeof(SetA).DisplayName(), typeof(SetB).DisplayName() }, model.GetEntityTypes().Select(e => e.Name).ToArray()); }
public void Adds_all_entities_based_on_all_distinct_entity_types_found() { var setFinder = new FakeSetFinder(); var context = InMemoryTestHelpers.Instance.CreateContext(); var serviceProvider = context.GetInfrastructure(); var model = CreateDefaultModelSource(setFinder) .GetModel( context, new RuntimeConventionSetBuilder( new ProviderConventionSetBuilder( serviceProvider.GetRequiredService <ProviderConventionSetBuilderDependencies>() with { SetFinder = setFinder }),
public void Adds_all_entities_based_on_all_distinct_entity_types_found() { var setFinder = new FakeSetFinder(); var model = CreateDefaultModelSource(setFinder) .GetModel( InMemoryTestHelpers.Instance.CreateContext(), new RuntimeConventionSetBuilder(new ProviderConventionSetBuilder( InMemoryTestHelpers.Instance.CreateContextServices().GetRequiredService <ProviderConventionSetBuilderDependencies>() .With(setFinder)), new List <IConventionSetCustomizer>())); Assert.Equal( new[] { typeof(SetA).DisplayName(), typeof(SetB).DisplayName() }, model.GetEntityTypes().Select(e => e.Name).ToArray()); }
public void Initializes_all_entity_set_properties_with_setters() { var setFinder = new FakeSetFinder(); var setSource = new DbSetSource(); var customServices = new ServiceCollection() .AddSingleton <IDbSetInitializer>( new DbSetInitializer(setFinder, setSource)); var serviceProvider = InMemoryTestHelpers.Instance.CreateServiceProvider(customServices); using var context = new JustAContext( new DbContextOptionsBuilder().UseInternalServiceProvider(serviceProvider).Options); Assert.NotNull(context.One); Assert.NotNull(context.GetTwo()); Assert.NotNull(context.Three); Assert.Null(context.Four); }