public Test() { ioc = new ServiceDefintions() .AddSingleton <IInterceptorConfiguration>(i => { var c = new InterceptorConfiguration(); //c.Interceptors.Add(new TestInterceptor()); return(c); }) .AddTransient <IInterceptorConfigurationHandler>(i => { return(new InterceptorAttributeConfigurationHandler(null)); }) .AddTransient <IInterceptorCreatorFactory, InterceptorCreatorFactory>() .AddSingleton <IInterceptDelegateBuilder>(i => { return(i.GetRequiredService <IInterceptorCreatorFactory>().Build()); }) .AddTransient <ISyncFunc, SyncFunc>() .AddTransient <ISyncFunc2, SyncFunc2>() .BuildServiceProvider(); real = ioc.GetRequiredService <ISyncFunc2>(); real.SyncCallNoParameters(); proxy = ioc.GetRequiredService <ISyncFunc>(); proxy.SyncCallNoParameters(); var containerBuilder = new ServiceContainer(); aspectcoreIoc = containerBuilder.AddType <ISyncFunc2, SyncFunc2>(AspectCore.Injector.Lifetime.Transient) .Build(); aspectcoreProxy = aspectcoreIoc.GetRequiredService <ISyncFunc2>(); aspectcoreProxy.SyncCallNoParameters(); }
public void CreateDelegateBuilder() { var builder = new ServiceDefintions() .AddSingleton <IInterceptorConfiguration>(i => { var c = new InterceptorConfiguration(); c.Interceptors.AddType <AddOne2>(); c.Interceptors.AddType <AddOne2>(whitelists: m => m != null); c.Interceptors.AddType <AddOne2>(blacklists: m => m != null); return(c); }) .AddTransient <IInterceptorConfigurationHandler>(i => { return(new InterceptorAttributeConfigurationHandler(null)); }) .AddTransient <IInterceptorCreatorFactory, InterceptorCreatorFactory>() .AddSingleton <IInterceptDelegateBuilder>(i => { return(i.GetRequiredService <IInterceptorCreatorFactory>().Build()); }) .BuildServiceProvider() .GetRequiredService <IInterceptDelegateBuilder>(); Assert.NotNull(builder); }
public void InterceptorConfigurationTest() { var config = new InterceptorConfiguration(); Assert.IsNotNull(config); Assert.AreEqual("/dashboard", config.DefaultDashboardRoute); Assert.AreEqual("/signalr", config.DefaultSignalrRoute); }