Exemplo n.º 1
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);
                });
            });
        }
Exemplo n.º 2
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);
        }