public void Merge_Should_Merge_ProviderExtensions() { // arrange var provider1 = new MockProviderExtensions(); var convention = new MockProjectionConvention(x => x.AddProviderExtension(provider1)); var provider2 = new MockProviderExtensions(); var extension = new ProjectionConventionExtension(x => x.AddProviderExtension(provider2)); var context = new ConventionContext( "Scope", new ServiceCollection().BuildServiceProvider(), DescriptorContext.Create()); convention.Initialize(context); extension.Initialize(context); // act extension.Merge(context, convention); // assert Assert.NotNull(convention.DefinitionAccessor); Assert.Collection( convention.DefinitionAccessor !.ProviderExtensions, x => Assert.Equal(provider1, x), x => Assert.Equal(provider2, x)); }
public void Merge_Should_Merge_Provider() { // arrange var convention = new MockProjectionConvention(x => x.Provider <QueryableProjectionProvider>()); var extension = new ProjectionConventionExtension(x => x.Provider <MockProvider>()); var context = new ConventionContext( "Scope", new ServiceCollection().BuildServiceProvider(), DescriptorContext.Create()); convention.Initialize(context); extension.Initialize(context); // act extension.Merge(context, convention); // assert Assert.Equal(typeof(MockProvider), convention.DefinitionAccessor?.Provider); }