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 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 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 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 LoadAndCheckContainsPlugin() { var col = new PluginsCollection(); col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME); Assert.True(col.Contains(TEST_PLUGIN1_FULLNAME)); Assert.False(col.Contains("fsefsefse")); }
public void LoadAndSelectPlugin() { var col = new PluginsCollection(); var plug1 = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME); var plug2 = col[TEST_PLUGIN1_FULLNAME].FirstOrDefault(); Assert.Equal(plug1, plug2); Assert.Equal(plug1, plug2); }
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 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); }
private void loadAllPlugins() { checkIfPluginsDirExists(); var assemblies = getAssembliesToLoad(); foreach (var assembly in assemblies) { _pluginsCollection.LoadPlugin(assembly); } informAboutChange(); }
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 LoadedPluginNotInCurrentAppDomain() { var col = new PluginsCollection(); var plug1 = col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, TEST_PLUGIN1_FULLNAME); var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies(); var foundAssembly = currentAssemblies.Where( x => x.FullName == plug1.ToString() || x.GetType().FullName == plug1.TypeFullName); Assert.NotNull(plug1); Assert.Equal(foundAssembly.Count(), 0); }
public void LoadPluginByBadAssembly() { var col = new PluginsCollection(); Assert.Throws <PluginsException>(() => col.LoadPlugin("badAsm")); }
public void LoadPluginByAsmAndBadName() { var col = new PluginsCollection(); Assert.Throws <TypeLoadException>(() => col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, "badfullname")); }
public void LoadPluginByBadAsmAndName() { var col = new PluginsCollection(); Assert.Throws <PluginsException>(() => col.LoadPlugin("Sosososbad", TEST_PLUGIN1_FULLNAME)); }
public void LoadPluginByAsmAndMissingName() { var col = new PluginsCollection(); Assert.Throws<PluginsException>(() => col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, null)); }
public void LoadPluginByMissingAsmAndName() { var col = new PluginsCollection(); Assert.Throws<PluginsException>(() => col.LoadPlugin(null, TEST_PLUGIN1_FULLNAME)); }
public void LoadPluginByBadAsmAndName() { var col = new PluginsCollection(); Assert.Throws<PluginsException>(() => col.LoadPlugin("Sosososbad", TEST_PLUGIN1_FULLNAME)); }
public void LoadPluginByAsmAndMissingName() { var col = new PluginsCollection(); Assert.Throws <PluginsException>(() => col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, null)); }
public void LoadPluginByBadAssembly() { var col = new PluginsCollection(); Assert.Throws<PluginsException>(() => col.LoadPlugin("badAsm")); }
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 LoadPluginByAsmAndBadName() { var col = new PluginsCollection(); Assert.Throws<TypeLoadException>(() => col.LoadPlugin(TEST_PLUGIN1_ASSEMBLY, "badfullname")); }
public void LoadPluginByMissingAsmAndName() { var col = new PluginsCollection(); Assert.Throws <PluginsException>(() => col.LoadPlugin(null, TEST_PLUGIN1_FULLNAME)); }