public void Test4_TypeNotFound()
        {
            ITracer        tracer = CreateDefaultTracer();
            PluginManifest pm     = PluginManifest.CreateByText(String.Format("manifest {{\r\n  {0}\\Core\\Core.dll {{\r\n plugin=NotFoundPlugin\r\n}}\r\n}}\r\n", PoderosaAppDir()));

            foreach (StructuredText t in pm.Children)
            {
                PluginManifest.AssemblyNode node = pm.LoadAssemblyNode(t);
                node.TryToBind(tracer);
                Assert.AreEqual(0, node.PluginTypes.Length);
                CheckOneErrorMessage(tracer.Document, String.Format(_stringResource.GetString("PluginManager.Messages.TypeLoadError"), node.Assembly.CodeBase, "NotFoundPlugin"));
            }
        }
Beispiel #2
0
        public void Test2_NormalLoad()
        {
            ITracer tracer = CreateDefaultTracer();

            Poderosa.Boot.PluginManifest pm = PluginManifest.CreateByText(String.Format("manifest {{\r\n  {0}\\Core.dll {{\r\n plugin=Poderosa.Preferences.PreferencePlugin\r\n}}\r\n}}\r\n", PoderosaAppDir()));
            int count = 0;

            foreach (PluginManifest.AssemblyEntry ent in pm.Entries)
            {
                Assert.AreEqual(1, ent.PluginTypeCount);
                Assert.AreEqual(1, ent.PluginTypes.Count());
                Assert.AreEqual("Poderosa.Preferences.PreferencePlugin", ent.PluginTypes.First());
                count++;
            }
            Assert.AreEqual(1, count); //アセンブリ指定は1個しかないので
        }
        public void Test2_NormalLoad()
        {
            ITracer        tracer = CreateDefaultTracer();
            PluginManifest pm     = PluginManifest.CreateByText(String.Format("manifest {{\r\n  {0}\\Core\\Core.dll {{\r\n plugin=Poderosa.Preferences.PreferencePlugin\r\n}}\r\n}}\r\n", PoderosaAppDir()));
            int            count  = 0;

            foreach (StructuredText t in pm.Children)
            {
                PluginManifest.AssemblyNode node = pm.LoadAssemblyNode(t);
                node.TryToBind(tracer);
                Assert.AreEqual(1, node.PluginTypes.Length); //これに失敗するときは型が見つからない
                Assert.AreEqual("Poderosa.Preferences.PreferencePlugin", node.PluginTypes[0].FullName);
                count++;
            }
            Assert.AreEqual(1, count); //アセンブリ指定は1個しかないので
        }
        public void Test3_AssemblyLoadError()
        {
            ITracer        tracer = CreateDefaultTracer();
            PluginManifest pm     = PluginManifest.CreateByText(String.Format("manifest {{\r\n  {0}\\notexist.dll {{\r\n  }}\r\n}}\r\n", PoderosaAppDir()));

            try {
                foreach (StructuredText t in pm.Children)
                {
                    PluginManifest.AssemblyNode node = pm.LoadAssemblyNode(t);
                    Assert.Fail("we expect exception");
                }
            }
            catch (Exception ex) {
                tracer.Trace(ex);
                Console.Out.WriteLine(ex.Message);
            }
        }
Beispiel #5
0
        public static IPoderosaApplication CreatePoderosaApplication(string plugin_manifest, StructuredText preference, string[] args)
        {
            string home_directory   = Directory.GetCurrentDirectory();
            InternalPoderosaWorld w = new InternalPoderosaWorld(new PoderosaStartupContext(PluginManifest.CreateByText(plugin_manifest), home_directory, preference, args, null));

            return(w);
        }