コード例 #1
0
ファイル: DiscoveryTest.cs プロジェクト: szawaski/Zerra
        public void ManyLayers()
        {
            var topLayerProvider = Discovery.GetImplementationTypes(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(), 0);

            Assert.AreEqual(1, topLayerProvider.Count);
            Assert.IsTrue(topLayerProvider.Contains(typeof(TestRuleProvider)));

            var ruleProvider = Discovery.GetImplementationTypes(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                ProviderLayers.GetProviderInterfaceIndex(typeof(IRuleProvider)));

            Assert.AreEqual(1, ruleProvider.Count);
            Assert.IsTrue(ruleProvider.Contains(typeof(TestRuleProvider)));

            var cacheProvider = Discovery.GetImplementationTypes(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                 ProviderLayers.GetProviderInterfaceIndex(typeof(ICacheProvider)));

            Assert.AreEqual(1, cacheProvider.Count);
            Assert.IsTrue(cacheProvider.Contains(typeof(TestCacheProvider)));

            var encryptionProvider = Discovery.GetImplementationTypes(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                      ProviderLayers.GetProviderInterfaceIndex(typeof(IEncryptionProvider)));

            Assert.AreEqual(1, encryptionProvider.Count);
            Assert.IsTrue(encryptionProvider.Contains(typeof(TestEncryptionProvider)));

            var compressionProvider = Discovery.GetImplementationTypes(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                       ProviderLayers.GetProviderInterfaceIndex(typeof(ICompressionProvider)));

            Assert.AreEqual(1, compressionProvider.Count);
            Assert.IsTrue(compressionProvider.Contains(typeof(TestCompressionProvider)));

            var dualbaseProvider = Discovery.GetImplementationTypes(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                    ProviderLayers.GetProviderInterfaceIndex(typeof(IDualBaseProvider)));

            Assert.AreEqual(1, dualbaseProvider.Count);
            Assert.IsTrue(dualbaseProvider.Contains(typeof(TestDualBaseProvider)));

            var provider = Discovery.GetImplementationTypes(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                            ProviderLayers.GetProviderInterfaceIndex(typeof(IBaseProvider)));

            Assert.AreEqual(1, provider.Count);
            Assert.IsTrue(provider.Contains(typeof(TestProvider)));
        }
コード例 #2
0
ファイル: DiscoveryTest.cs プロジェクト: szawaski/Zerra
        public void HasLayers()
        {
            var topLayerProvider = Discovery.HasImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(), 0);

            Assert.IsTrue(topLayerProvider);

            var ruleProvider = Discovery.HasImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                               ProviderLayers.GetProviderInterfaceIndex(typeof(IRuleProvider)));

            Assert.IsTrue(ruleProvider);

            var cacheProvider = Discovery.HasImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                ProviderLayers.GetProviderInterfaceIndex(typeof(ICacheProvider)));

            Assert.IsTrue(cacheProvider);

            var encryptionProvider = Discovery.HasImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                     ProviderLayers.GetProviderInterfaceIndex(typeof(IEncryptionProvider)));

            Assert.IsTrue(encryptionProvider);

            var compressionProvider = Discovery.HasImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                      ProviderLayers.GetProviderInterfaceIndex(typeof(ICompressionProvider)));

            Assert.IsTrue(compressionProvider);

            var dualbaseProvider = Discovery.HasImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                   ProviderLayers.GetProviderInterfaceIndex(typeof(IDualBaseProvider)));

            Assert.IsTrue(dualbaseProvider);

            var provider = Discovery.HasImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                           ProviderLayers.GetProviderInterfaceIndex(typeof(IBaseProvider)));

            Assert.IsTrue(provider);
        }
コード例 #3
0
ファイル: DiscoveryTest.cs プロジェクト: szawaski/Zerra
        public void Layers()
        {
            var topLayerProvider = Discovery.GetImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(), 0);

            Assert.AreEqual(typeof(TestRuleProvider), topLayerProvider);

            var ruleProvider = Discovery.GetImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                               ProviderLayers.GetProviderInterfaceIndex(typeof(IRuleProvider)));

            Assert.AreEqual(typeof(TestRuleProvider), ruleProvider);

            var cacheProvider = Discovery.GetImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                ProviderLayers.GetProviderInterfaceIndex(typeof(ICacheProvider)));

            Assert.AreEqual(typeof(TestCacheProvider), cacheProvider);

            var encryptionProvider = Discovery.GetImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                     ProviderLayers.GetProviderInterfaceIndex(typeof(IEncryptionProvider)));

            Assert.AreEqual(typeof(TestEncryptionProvider), encryptionProvider);

            var compressionProvider = Discovery.GetImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                      ProviderLayers.GetProviderInterfaceIndex(typeof(ICompressionProvider)));

            Assert.AreEqual(typeof(TestCompressionProvider), compressionProvider);

            var dualbaseProvider = Discovery.GetImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                                   ProviderLayers.GetProviderInterfaceIndex(typeof(IDualBaseProvider)));

            Assert.AreEqual(typeof(TestDualBaseProvider), dualbaseProvider);

            var provider = Discovery.GetImplementationType(typeof(ITestProvider), ProviderLayers.GetProviderInterfaceStack(),
                                                           ProviderLayers.GetProviderInterfaceIndex(typeof(IBaseProvider)));

            Assert.AreEqual(typeof(TestProvider), provider);
        }