예제 #1
0
        public void TestAddAssemblyTwice()
        {
            using (TestPluginManager pluginManager = new TestPluginManager())
            {
                IPluginHelperService pluginServices = new PluginServices(pluginManager) as IPluginHelperService;

                Assert.IsNotNull(pluginServices);

                Assembly current = Assembly.GetExecutingAssembly();

                DynamicLoadResult loadResult = pluginServices.AddAssembly(current);

                Assert.IsTrue(loadResult == DynamicLoadResult.Success);

                pluginServices.PluginLoaded(System.IO.Path.GetFileName(current.Location), out int version);

                Assert.IsTrue(version == 1);

                loadResult = pluginServices.AddAssembly(current);

                Assert.IsTrue(loadResult == DynamicLoadResult.AlreadyLoaded);
            }
        }