Handler that invokes a plugin in its own app domain
Inheritance: System.MarshalByRefObject, IRuntime
コード例 #1
0
        public void PluginRuntimeHandler_FetchNamespaceListObject_WhenNullDll_ExpectException()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();

            //------------Execute Test---------------------------
            pluginRuntimeHandler.FetchNamespaceListObject(null);
        }
コード例 #2
0
        public void PluginRuntimeHandler_FetchNamespaceListObject_WhenNullLocationInSource_ExpectException()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();
            var source = CreatePluginSource(true);

            //------------Execute Test---------------------------
            pluginRuntimeHandler.FetchNamespaceListObject(source);

        }
コード例 #3
0
        public void PluginRuntimeHandler_FetchNamespaceListObject_WhenValidDll_ExpectNamespaces()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();
            var source = CreatePluginSource();

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.FetchNamespaceListObject(source);

            //------------Assert Results-------------------------
            Assert.IsTrue(result.Count > 0);
        }
コード例 #4
0
        public void PluginRuntimeHandler_Run_WhenNullParameters_ExpectException()
        {
            //------------Setup for test--------------------------
            var svc = CreatePluginService();
            var source = CreatePluginSource();
            var pluginRuntimeHandler = new PluginRuntimeHandler();
            PluginInvokeArgs args = new PluginInvokeArgs { AssemblyLocation = source.AssemblyLocation, AssemblyName = "Foo", Fullname = svc.Namespace, Method = svc.Method.Name, Parameters = null };

            //------------Execute Test---------------------------
            pluginRuntimeHandler.Run(args);
        }
コード例 #5
0
        public void PluginRuntimeHandler_ListNamespaces_WhenInvalidLocation_ExpectNoResults()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.ListNamespaces("z:\foo\asm.dll", "Foo");

            Assert.IsFalse(result.Any());
        }
コード例 #6
0
        public void PluginRuntimeHandler_Run_WhenValidLocation_ExpectResult()
        {
            //------------Setup for test--------------------------
            var svc = CreatePluginService();
            var source = CreatePluginSource();
            var pluginRuntimeHandler = new PluginRuntimeHandler();
            PluginInvokeArgs args = new PluginInvokeArgs { AssemblyLocation = source.AssemblyLocation, AssemblyName = "Foo", Fullname = svc.Namespace, Method = svc.Method.Name, Parameters = svc.Method.Parameters };

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.Run(args);
            var castResult = result as DummyClassForPluginTest;

            //------------Assert Results-------------------------
            if(castResult != null)
            {
                StringAssert.Contains(castResult.Name, "test data");
            }
            else
            {
                Assert.Fail("Failed Conversion for Assert");
            }
        }
コード例 #7
0
        public void PluginRuntimeHandler_ListNamespaces_WhenValidLocation_ExpectNamespaces()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();
            var source = CreatePluginSource();

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.ListNamespaces(source.AssemblyLocation, "Foo");

            //------------Assert Results-------------------------
            Assert.IsTrue(result.Any());
        }
コード例 #8
0
        public void PluginRuntimeHandler_ListNamespaces_WhenNullLocation_ExpectException()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();

            //------------Execute Test---------------------------
            pluginRuntimeHandler.ListNamespaces(null, "Foo");
        }
コード例 #9
0
        public void PluginRuntimeHandler_ValidatePlugin_WhenNullDll_ExpectErrorMessage()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();

            //------------Execute Test---------------------------
            pluginRuntimeHandler.ValidatePlugin(null);
        }
コード例 #10
0
        public void PluginRuntimeHandler_ValidatePlugin_WhenInvalidGacDll_ExpectErrorMessage()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.ValidatePlugin("GAC:mscorlib_foo, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");

            //------------Assert Results-------------------------
            StringAssert.Contains(result, "Could not load file or assembly 'mscorlib_foo");
        }
コード例 #11
0
        public void PluginRuntimeHandler_ValidatePlugin_WhenGacDll_ExpectBlankMessage()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.ValidatePlugin("GAC:mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");

            //------------Assert Results-------------------------
            StringAssert.Contains(result, string.Empty);
        }
コード例 #12
0
        public void PluginRuntimeHandler_ValidatePlugin_WhenNotADll_ExpectErrorMessage()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();
            var source = CreatePluginSource();

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.ValidatePlugin(source.AssemblyLocation + ".foo");

            //------------Assert Results-------------------------
            StringAssert.Contains(result, "Not a Dll file");
        }
コード例 #13
0
        public void PluginRuntimeHandler_ValidatePlugin_WhenValidDll_ExpectBlankMessage()
        {
            //------------Setup for test--------------------------
            var pluginRuntimeHandler = new PluginRuntimeHandler();
            var source = CreatePluginSource();

            //------------Execute Test---------------------------
            var result = pluginRuntimeHandler.ValidatePlugin(source.AssemblyLocation);

            //------------Assert Results-------------------------
            StringAssert.Contains(result, string.Empty);
        }