예제 #1
0
        public void AppPluginsComposed_FromOnlyOtherAppPluginTypesOnly()
        {
            ContainerFixture.Test(fixture =>
            {
                fixture.Arrange.Container(c =>
                {
                    var hostPlugin = new MockHostPlugin();
                    hostPlugin.AddPluginType <MockTypeOneBasedOnKnownType>();

                    var corePlugin = new MockCorePlugin();
                    corePlugin.AddPluginType <MockTypeThreeBasedOnKnownType>();

                    var corePlugin2 = new MockCorePlugin();
                    corePlugin2.AddPluginType <MockTypeTwoBasedOnKnownType>();

                    var appPlugin = new MockApplicationPlugin();
                    appPlugin.AddModule <MockComposedModule>();

                    c.RegisterPlugins(hostPlugin, corePlugin, corePlugin2, appPlugin);
                })
                .Assert.PluginModule <MockComposedModule>(m =>
                {
                    m.ImportedTypes.Should().NotBeNull();
                    m.ImportedTypes.Should().HaveCount(1);
                    m.ImportedTypes.OfType <MockTypeOneBasedOnKnownType>().Should().HaveCount(1);
                });
            });
        }
예제 #2
0
        public void CorePluginsComposed_FromAllOtherPluginTypes()
        {
            ContainerFixture.Test(fixture =>
            {
                fixture.Arrange.Container(c =>
                {
                    var hostPlugin = new MockHostPlugin();
                    hostPlugin.AddPluginType <MockTypeOneBasedOnKnownType>();

                    var appPlugin = new MockApplicationPlugin();
                    appPlugin.AddPluginType <MockTypeTwoBasedOnKnownType>();

                    var corePlugin = new MockCorePlugin();
                    corePlugin.AddPluginType <MockTypeThreeBasedOnKnownType>();

                    c.RegisterPlugins(hostPlugin, appPlugin, corePlugin);

                    // This core plug-in contains a module that is composed
                    // from types contained within the above plug-ins.
                    var composedPlugin = new MockCorePlugin();
                    composedPlugin.AddModule <MockComposedModule>();

                    c.RegisterPlugins(composedPlugin);
                })
                .Assert.PluginModule <MockComposedModule>(m =>
                {
                    m.ImportedTypes.Should().NotBeNull();
                    m.ImportedTypes.Should().HaveCount(3);
                    m.ImportedTypes.OfType <MockTypeOneBasedOnKnownType>().Should().HaveCount(1);
                    m.ImportedTypes.OfType <MockTypeTwoBasedOnKnownType>().Should().HaveCount(1);
                    m.ImportedTypes.OfType <MockTypeThreeBasedOnKnownType>().Should().HaveCount(1);
                });
            });
        }
예제 #3
0
        public static CompositeContainer AddEventAndExceptionConsumer(this CompositeContainer container)
        {
            var appPlugin = new MockApplicationPlugin();

            appPlugin.AddPluginType <MockErrorMessageConsumer>();

            container.RegisterPlugins(appPlugin);
            return(container);
        }
        public static CompositeContainer AddMultipleConsumers(this CompositeContainer container)
        {
            var appPlugin = new MockApplicationPlugin();

            appPlugin.AddPluginType <MockInvalidCommandConsumer>();

            container.RegisterPlugins(appPlugin);
            container.RegisterPlugin <MessagingPlugin>();

            return(container);
        }