public void LoadAndRemoveAllPlugins()
        {
            var col = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);

            Assert.NotNull(plug);
            Assert.True(col.Any());

            col.StopAndRemoveAll();
            Assert.Equal(col.Count(), 0);
        }
Пример #2
0
        public void LoadAndRemoveAllPlugins()
        {
            var col  = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);

            Assert.NotNull(plug);
            Assert.True(col.Any());

            col.StopAndRemoveAll();
            Assert.Equal(col.Count(), 0);
        }
Пример #3
0
        public void LoadAndRemoveAllPluginsAndGCCollect()
        {
            var col   = new PluginsCollection();
            var plug1 = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);
            var plug2 = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);

            Assert.NotNull(plug1);
            Assert.NotNull(plug2);
            Assert.Equal(col.Count(), 2);

            col.StopAndRemoveAll();
            Assert.Equal(col.Count(), 0);

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            Assert.Throws <AppDomainUnloadedException>(() => plug1.GetFields());
            Assert.Throws <AppDomainUnloadedException>(() => plug1.Close());
            Assert.Throws <AppDomainUnloadedException>(() => plug2.GetFields());
            Assert.Throws <AppDomainUnloadedException>(() => plug2.Close());
        }
        public void LoadAndRemoveAllPluginsAndGCCollect()
        {
            var col = new PluginsCollection();
            var plug1 = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);
            var plug2 = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);

            Assert.NotNull(plug1);
            Assert.NotNull(plug2);
            Assert.Equal(col.Count(), 2);

            col.StopAndRemoveAll();
            Assert.Equal(col.Count(), 0);

            GC.Collect();
            GC.WaitForPendingFinalizers();
            GC.Collect();

            Assert.Throws<AppDomainUnloadedException>(() => plug1.GetFields());
            Assert.Throws<AppDomainUnloadedException>(() => plug1.Close());
            Assert.Throws<AppDomainUnloadedException>(() => plug2.GetFields());
            Assert.Throws<AppDomainUnloadedException>(() => plug2.Close());
        }