public void AddInstanceFromContainer() { var one = new SomethingOne(); var container = new Container(); container.Inject <ISomething>(one); one.ShouldBeTheSameAs(container.GetInstance <ISomething>()); }
public void OverwriteInstanceFromObjectFactory() { var one = new SomethingOne(); var two = new SomethingOne(); var container = new Container(); container.Inject <ISomething>(one); container.Inject <ISomething>(two); two.ShouldBeTheSameAs(container.GetInstance <ISomething>()); }
public void AddNamedInstanceToobjectFactory() { var one = new SomethingOne(); var two = new SomethingOne(); var container = new Container(r => { r.For <ISomething>().AddInstances(x => { x.Object(one).Named("One"); x.Object(two).Named("Two"); }); }); one.ShouldBeTheSameAs(container.GetInstance <ISomething>("One")); two.ShouldBeTheSameAs(container.GetInstance <ISomething>("Two")); }