public void AspectInstance_InHierarchy_MustBeOne()
        {
            var target = new TestInjectionTarget();

            Assert.Equal(1, target.Test1());
            Assert.Equal(2, target.Test2());
        }
Esempio n. 2
0
        public void TestNamedInjection()
        {
            var          context     = new InjectionContext();
            const string standardKey = "HELLO WORLD";
            const string namedKey    = "SPECIAL STRING";

            context.addMapping <string>(standardKey);
            context.addNamedMapping <string>(NamedInjections.INTERNAL_TESTING_SPECIAL_KEY, namedKey);
            var target = new TestInjectionTarget();

            Assert.IsNullOrEmpty(target.testString);
            context.setMappings(target);
            Assert.AreSame(target.testString, standardKey);
            Assert.AreSame(target.specialString, namedKey);
            Assert.AreNotEqual(standardKey, namedKey);
            Assert.AreNotEqual(target.testString, target.specialString);
        }
 public void TestNamedInjection()
 {
     var context = new InjectionContext();
     const string standardKey = "HELLO WORLD";
     const string namedKey = "SPECIAL STRING";
     context.addMapping<string>(standardKey);
     context.addNamedMapping<string>(NamedInjections.INTERNAL_TESTING_SPECIAL_KEY, namedKey);
     var target = new TestInjectionTarget();
     Assert.IsNullOrEmpty(target.testString);
     context.setMappings(target);
     Assert.AreSame(target.testString, standardKey);
     Assert.AreSame(target.specialString, namedKey);
     Assert.AreNotEqual(standardKey, namedKey);
     Assert.AreNotEqual(target.testString, target.specialString);
 }