Esempio n. 1
0
        public void GetPlugInFromCustomContainerWithAllImplementedInterfaces()
        {
            var manager   = new PlugInManager(null, new NullLoggerFactory(), null);
            var container = new CustomTestPlugInContainer(manager);

            container.AddPlugIn(new TestCustomPlugIn2(), true);
            Assert.That(container.GetPlugIn <ITestCustomPlugIn>(), Is.Not.Null);
            Assert.That(container.GetPlugIn <IAnotherCustomPlugIn>(), Is.Not.Null);
        }
Esempio n. 2
0
        public void GetPlugInFromCustomContainerWithInitiallyRegisteredPlugIn()
        {
            var manager = new PlugInManager(null, new NullLoggerFactory(), null);

            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn>();
            var container = new CustomTestPlugInContainer(manager);
            var plugIn    = container.GetPlugIn <ITestCustomPlugIn>();

            Assert.That(plugIn, Is.Not.Null);
        }
Esempio n. 3
0
        public void DontGetPlugInFromCustomContainerIfItDoesntSuit()
        {
            var manager   = new PlugInManager(null, new NullLoggerFactory(), null);
            var container = new CustomTestPlugInContainer(manager);

            container.CreateNewPlugIns = false;
            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn>();
            var plugIn = container.GetPlugIn <ITestCustomPlugIn>();

            Assert.That(plugIn, Is.Null);
        }
Esempio n. 4
0
        public void GetPlugInFromCustomContainerWithRegisteredPlugInAfterRegistration()
        {
            var manager   = new PlugInManager();
            var container = new CustomTestPlugInContainer(manager);

            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn>();

            var plugIn = container.GetPlugIn <ITestCustomPlugIn>();

            Assert.That(plugIn, Is.Not.Null);
        }
Esempio n. 5
0
        public void DontGetPlugInFromCustomContainerAfterDeactivation()
        {
            var manager = new PlugInManager(null, new NullLoggerFactory(), null);

            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn>();
            var container = new CustomTestPlugInContainer(manager);

            manager.DeactivatePlugIn <TestCustomPlugIn>();
            var plugIn = container.GetPlugIn <ITestCustomPlugIn>();

            Assert.That(plugIn, Is.Null);
        }
Esempio n. 6
0
        public void ReplacePlugInAtCustomContainer()
        {
            var manager = new PlugInManager(null, new NullLoggerFactory(), null);

            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn>();
            var container = new CustomTestPlugInContainer(manager);

            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn2>();
            var plugIn = container.GetPlugIn <ITestCustomPlugIn>();

            Assert.That(plugIn, Is.InstanceOf <TestCustomPlugIn2>());
        }
Esempio n. 7
0
        public void ReactivatePlugInAtCustomContainer()
        {
            var manager = new PlugInManager();

            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn>();
            var container = new CustomTestPlugInContainer(manager);

            manager.RegisterPlugIn <ITestCustomPlugIn, TestCustomPlugIn2>();
            manager.DeactivatePlugIn <TestCustomPlugIn2>();
            var plugIn = container.GetPlugIn <ITestCustomPlugIn>();

            Assert.That(plugIn, Is.InstanceOf <TestCustomPlugIn>());
        }