Beispiel #1
0
        public void EmptyPluginsCollectionAtStart()
        {
            var col        = new PluginsCollection();
            var startCount = col.Count();

            Assert.Equal(startCount, 0);
        }
        public void LoadTestPluginByAssemblyWithoutExtension()
        {
            var col = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY_WITHOUT_EXTENSION);

            Assert.Equal(plug.Count(), 1);
            Assert.Equal(col.Count(), 1);
        }
        public void LoadTestPluginByAssemblyAndName()
        {
            var col = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);

            Assert.Equal(col.Count(), 1);
            Assert.NotNull(plug);
        }
Beispiel #4
0
        public void LoadTestPluginByAssemblyWithoutExtension()
        {
            var col  = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY_WITHOUT_EXTENSION);

            Assert.Equal(plug.Count(), 1);
            Assert.Equal(col.Count(), 1);
        }
Beispiel #5
0
        public void LoadTestPluginByAssemblyAndName()
        {
            var col  = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);

            Assert.Equal(col.Count(), 1);
            Assert.NotNull(plug);
        }
        public void LoadTestPluginByAssembly()
        {
            var col = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY);
            var count = plug.Count();

            Assert.Equal(count, 1);
            Assert.Equal(col.Count(), 1);
        }
Beispiel #7
0
        public void LoadTestPluginByAssembly()
        {
            var col   = new PluginsCollection();
            var plug  = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY);
            var count = plug.Count();

            Assert.Equal(count, 1);
            Assert.Equal(col.Count(), 1);
        }
        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);
        }
Beispiel #9
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);
        }
Beispiel #10
0
        public void LoadTwoSamePlugins()
        {
            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.NotEqual(plug1.GetHashCode(), plug2.GetHashCode());
            Assert.NotEqual(plug1.GetHashCode(), plug2.GetHashCode());
            Assert.Equal(col.Count(), 2);
        }
Beispiel #11
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());
        }
Beispiel #12
0
        public void LoadAndUsingPluginsWithGCCollect()
        {
            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);

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

            Assert.DoesNotThrow(() => plug1.GetFields());
            Assert.DoesNotThrow(plug1.Close);
            Assert.DoesNotThrow(() => plug2.GetFields());
            Assert.DoesNotThrow(plug2.Close);
        }
        public void LoadAndRemovePluginAndGCCollect()
        {
            var col = new PluginsCollection();
            var plug = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME);

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

            col.RemovePlugin(plug);
            Assert.Equal(col.Count(), 0);

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

            Assert.Throws<AppDomainUnloadedException>(() => plug.GetFields());
            Assert.Throws<AppDomainUnloadedException>(() => plug.Close());
        }
 public void EmptyPluginsCollectionAtStart()
 {
     var col = new PluginsCollection();
     var startCount = col.Count();
     Assert.Equal(startCount, 0);
 }
        public void LoadTwoSamePlugins()
        {
            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.NotEqual(plug1.GetHashCode(), plug2.GetHashCode());
            Assert.NotEqual(plug1.GetHashCode(), plug2.GetHashCode());
            Assert.Equal(col.Count(), 2);
        }
        public void LoadAndUsingPluginsWithGCCollect()
        {
            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);

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

            Assert.DoesNotThrow(() => plug1.GetFields());
            Assert.DoesNotThrow(plug1.Close);
            Assert.DoesNotThrow(() => plug2.GetFields());
            Assert.DoesNotThrow(plug2.Close);
        }