Example #1
0
        public void Resolve_UsingNamedExpressionOfSpecificTypeAndAutoWithoutNameOfTheSameType_ReturnsDifferentInstancesOfTheSameType() {
            var container = new NCopContainer(registry => {
                registry.Register<Foo>().Named("NCop");
                registry.Register<Foo>();
            });

            var instance = container.Resolve<Foo>();
            var namedInstance = container.ResolveNamed<Foo>("NCop");

            Assert.AreNotSame(namedInstance, instance);
        }
Example #2
0
        public void Resolve_UsingNamedExpressionOfSpecificTypeAndAutoWithoutNameOfTheSameType_ReturnsDifferentInstancesOfTheSameType()
        {
            var container = new NCopContainer(registry => {
                registry.Register <Foo>().Named("NCop");
                registry.Register <Foo>();
            });

            var instance      = container.Resolve <Foo>();
            var namedInstance = container.ResolveNamed <Foo>("NCop");

            Assert.AreNotSame(namedInstance, instance);
        }
 public TService ResolveNamed <TService>(string name)
 {
     return(container.ResolveNamed <TService>(name));
 }