private void findRule3() { _rule3 = container.GetInstance <Rule>().ShouldBeOfType <ColorRule>(); var rule = container.GetInstance <Rule>().ShouldBeOfType <ColorRule>(); _rule3.ShouldBeTheSameAs(rule); rule = container.GetInstance <Rule>().ShouldBeOfType <ColorRule>(); _rule3.ShouldBeTheSameAs(rule); rule = container.GetInstance <Rule>().ShouldBeOfType <ColorRule>(); _rule3.ShouldBeTheSameAs(rule); rule = container.GetInstance <Rule>().ShouldBeOfType <ColorRule>(); _rule3.ShouldBeTheSameAs(rule); }
public void InjectStub_by_name() { IContainer container = new Container(); var red = new ColorRule("Red"); var blue = new ColorRule("Blue"); container.Configure(x => { x.For <Rule>().Add(red).Named("Red"); x.For <Rule>().Add(blue).Named("Blue"); }); red.ShouldBeTheSameAs(container.GetInstance <Rule>("Red")); blue.ShouldBeTheSameAs(container.GetInstance <Rule>("Blue")); }