public void CanRegisterByType() { IMicroIocContainer iocContainer = new MicroIocContainer(); var newContainer = iocContainer.Register <IFoo>(typeof(Foo)); Assert.AreSame(iocContainer, newContainer); }
public void RegisterIsFluent() { IMicroIocContainer iocContainer = new MicroIocContainer(); var newContainer = iocContainer.Register <IFoo, Foo>(); Assert.AreSame(iocContainer, newContainer); }
public void RegisteringSubsequentImplentationTypesOverwritesPrevious() { var iocContainer = new MicroIocContainer() .Register <IFoo, Foo>(); Assert.IsInstanceOfType(iocContainer.Resolve <IFoo>(), typeof(Foo)); iocContainer.Register <IFoo, Foo2>(); Assert.IsInstanceOfType(iocContainer.Resolve <IFoo>(), typeof(Foo2)); }
public void CanRegisterWithoutExceptions() { var threw = false; try { var iocContainer = new MicroIocContainer(); iocContainer.Register <IFoo, Foo>(); } catch (Exception) { threw = true; } finally { Assert.IsFalse(threw, "Failed to register without an exception"); } }
public void CanRegisterWithoutExceptions() { var threw = false; try { var iocContainer = new MicroIocContainer(); iocContainer.Register<IFoo, Foo>(); } catch (Exception) { threw = true; } finally { Assert.IsFalse(threw, "Failed to register without an exception"); } }
public void CanRegisterByType() { IMicroIocContainer iocContainer = new MicroIocContainer(); var newContainer = iocContainer.Register<IFoo>(typeof(Foo)); Assert.AreSame(iocContainer, newContainer); }
public void RegisterIsFluent() { IMicroIocContainer iocContainer = new MicroIocContainer(); var newContainer = iocContainer.Register<IFoo, Foo>(); Assert.AreSame(iocContainer, newContainer); }
public void RegisteringSubsequentImplentationTypesOverwritesPrevious() { var iocContainer = new MicroIocContainer() .Register<IFoo, Foo>(); Assert.IsInstanceOfType(iocContainer.Resolve<IFoo>(), typeof(Foo)); iocContainer.Register<IFoo, Foo2>(); Assert.IsInstanceOfType(iocContainer.Resolve<IFoo>(), typeof(Foo2)); }