public void Bug_16900_CanUseNonDefaultLifetimeManagerWithOpenGenericRegistration() { IUnityContainer container = new UnityContainer(); container.RegisterType(typeof(ITestFoo <>), typeof(MyFoo <>), new ContainerControlledLifetimeManager()); ITestFoo <int> intFoo = container.Resolve <ITestFoo <int> >(); ITestFoo <string> stringFoo1 = container.Resolve <ITestFoo <string> >(); ITestFoo <string> stringFoo2 = container.Resolve <ITestFoo <string> >(); Assert.AreSame(stringFoo1, stringFoo2); }
public void Bug_16900_CanOverrideGenericLifetimeManagerWithSpecificOne() { IUnityContainer container = new UnityContainer() .RegisterType(typeof(ITestFoo <>), typeof(MyFoo <>), new ContainerControlledLifetimeManager()) .RegisterType(typeof(MyFoo <double>), new TransientLifetimeManager()); ITestFoo <string> string1 = container.Resolve <ITestFoo <string> >(); ITestFoo <string> string2 = container.Resolve <ITestFoo <string> >(); ITestFoo <double> double1 = container.Resolve <ITestFoo <double> >(); ITestFoo <double> double2 = container.Resolve <ITestFoo <double> >(); Assert.AreSame(string1, string2); Assert.AreNotSame(double1, double2); }
public void FooInterfacePayload(ITestFoo foo) { }
public void FooInterfacePayload(ITestFoo foo) { }