Beispiel #1
0
 static Resolver()
 {
     // A example for registration of resolvers!
     DynamicResolver.Register <Resolver>("a", typeof(SomeObject));
 }
Beispiel #2
0
 public static void RegisterExtension(string name, Type type)
 {
     DynamicResolver.Register <ExtensionsResolverTag>(name, type);
 }
Beispiel #3
0
 static Resolver()
 {
     // A example for registration of resolvers
     DynamicResolver.Register <Resolver>("b", typeof(int));
 }
Beispiel #4
-1
        public void PassTest()
        {
            Type ty;

            Assert.False(DynamicResolver.Find <Tag>("a", out ty));

            DynamicResolver.Register <Tag>("a", typeof(int));
            DynamicResolver.Register <Tag>("b", typeof(string));

            Assert.True(DynamicResolver.Find <Tag>("a", out ty));
            Assert.True(DynamicResolver.Find <Tag>("b", out ty));
            Assert.False(DynamicResolver.Find <Tag>("c", out ty));

            DynamicResolver.DeRegister <Tag>("b");

            Assert.True(DynamicResolver.Find <Tag>("a", out ty));
            Assert.False(DynamicResolver.Find <Tag>("b", out ty)); // "b" is unregisterd

            DynamicResolver.DeRegister <Tag>();

            Assert.False(DynamicResolver.Find <Tag>("a", out ty)); // All keys for Tag are unregisterd
        }