public void CanCreatLifetimeManagedeWrappedObjectOverInterface() { GlobalCountCallHandler.Calls.Clear(); IUnityContainer container = CreateContainer("CanCreateWrappedObjectOverInterface"); container .RegisterType <Interface, WrappableThroughInterface>(new ContainerControlledLifetimeManager()) .Configure <Interception>() .SetInterceptorFor <Interface>(new TransparentProxyInterceptor()); Interface wrappedOverInterface = container.Resolve <Interface>(); wrappedOverInterface.Method(); WrappableThroughInterface wrapped = container.Resolve <WrappableThroughInterface>(); wrapped.Method(); Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanCreateWrappedObjectOverInterface"]); }
public void CanCreatLifetimeManagedeWrappedObjectOverInterface() { GlobalCountCallHandler.Calls.Clear(); IUnityContainer container = CreateContainer("CanCreateWrappedObjectOverInterface"); container .RegisterType <Interface, WrappableThroughInterface>(new ContainerControlledLifetimeManager()) .RegisterType <Interface>( new Interceptor <InterfaceInterceptor>(), new InterceptionBehavior <PolicyInjectionBehavior>()); Interface wrappedOverInterface = container.Resolve <Interface>(); wrappedOverInterface.Method(); WrappableThroughInterface wrapped = container.Resolve <WrappableThroughInterface>(); wrapped.Method(); Assert.AreEqual(1, GlobalCountCallHandler.Calls["CanCreateWrappedObjectOverInterface"]); }