public void RegisterInstanceIsFluent() { IMicroIocContainer iocContainer = new MicroIocContainer(); var newContainer = iocContainer.RegisterInstance <IFoo>(new Foo()); Assert.AreSame(iocContainer, newContainer); }
public void RegisteringSubsequentInstancesOfTypeWithSameKeyOverwritesPrevious() { const string key = "fooKey"; // Nell var foo1 = new Foo(); var foo2 = new Foo(); var iocContainer = new MicroIocContainer() .RegisterInstance <IFoo>(foo1, key); Assert.AreSame(foo1, iocContainer.Resolve <IFoo>(key)); iocContainer.RegisterInstance <IFoo>(foo2, key); Assert.AreSame(foo2, iocContainer.Resolve <IFoo>(key)); }
public void RegisterInstanceIsFluent() { IMicroIocContainer iocContainer = new MicroIocContainer(); var newContainer = iocContainer.RegisterInstance<IFoo>(new Foo()); Assert.AreSame(iocContainer, newContainer); }
public void RegisteringSubsequentInstancesOfTypeWithSameKeyOverwritesPrevious() { const string key = "fooKey"; // Nell var foo1 = new Foo(); var foo2 = new Foo(); var iocContainer = new MicroIocContainer() .RegisterInstance<IFoo>(foo1, key); Assert.AreSame(foo1, iocContainer.Resolve<IFoo>(key)); iocContainer.RegisterInstance<IFoo>(foo2, key); Assert.AreSame(foo2, iocContainer.Resolve<IFoo>(key)); }