public void ShouldDiscoverDefaultSyncInterceptor() { CompositionContext context = CompositionContext.Default .WithGenerator(typeof(IEntityManagerSyncInterceptor), () => new SyncInterceptor()) .WithName("ShouldDiscoverDefault"); var partLocator1 = new PartLocator <IEntityManagerSyncInterceptor>(false, () => context); PartLocator <IEntityManagerSyncInterceptor> partLocator2 = new PartLocator <IEntityManagerSyncInterceptor>() .WithDefaultGenerator(() => new DefaultEntityManagerSyncInterceptor()); IEntityManagerSyncInterceptor obj1 = partLocator1.GetPart(); Assert.IsTrue(obj1.GetType() == typeof(SyncInterceptor), "Should have found the SyncInterceptor"); IEntityManagerSyncInterceptor obj2 = partLocator2.GetPart(); Assert.IsTrue(obj2.GetType() == typeof(DefaultEntityManagerSyncInterceptor), "Should have found the DefaultSyncInterceptor"); }
public IEntityManagerProviderConfigurator <T> WithSyncInterceptor(IEntityManagerSyncInterceptor syncInterceptor) { SyncInterceptor = syncInterceptor; return(this); }