Пример #1
0
        public void TestGenericInheritance()
        {
            IServiceCollection serviceCollection = new ServiceCollection();

            serviceCollection.AddTransientPlugins <TestInterfaces.ITestInterface>("TestAssemblies/GenericTestAssembly/**/*.dll");
            System.Collections.Generic.IEnumerable <TestInterfaces.ITestInterface> services = serviceCollection.BuildServiceProvider().GetServices <TestInterfaces.ITestInterface>();

            AssertCollection.CollectionHasAny(services, output,
                                              t => Assert.Equal(typeof(GenericClass), t.GetType()),
                                              t => Assert.Equal(typeof(ControlClass), t.GetType())
                                              );
        }
Пример #2
0
        public void TestLoadingFromSeperateFolders()
        {
            IServiceCollection serviceCollection = new ServiceCollection();

            serviceCollection.AddTransientPlugins <TestInterfaces.ITestInterface>("TestAssemblies/TestAssembly1/**/*.dll", "TestAssemblies/TestAssembly2/**/*.dll");
            System.Collections.Generic.IEnumerable <TestInterfaces.ITestInterface> services = serviceCollection.BuildServiceProvider().GetServices <TestInterfaces.ITestInterface>();

            AssertCollection.CollectionHasAny(services, output,
                                              t => Assert.Equal(typeof(MultiAssemblyPlugin), t.GetType()),
                                              t => Assert.Equal(typeof(TestPlugin), t.GetType()),
                                              t => Assert.Equal(typeof(AnotherTestPlugin), t.GetType()),
                                              t => Assert.Equal(typeof(TestPlugin2), t.GetType()));
        }