public void PluginRuntimeHandler_Test_WhenHasInnerError_ExpectInerErrors()
        {
            //------------Setup for test--------------------------

            var type = typeof(Human);
            var svc  = CreatePluginService(new List <IDev2MethodInfo> {
                new Dev2MethodInfo {
                    Method = "set_Name", Parameters = new List <IMethodParameter>()
                    {
                        new ConstructorParameter()
                        {
                            Name = "value", Value = "Micky", TypeName = typeof(string).FullName, IsRequired = true
                        }
                    }
                }
            }, type, new ServiceConstructor());
            //------------Execute Test---------------------------
            var      mock = new Mock <IAssemblyLoader>();
            Assembly loadedAssembly;

            var handler = new PluginRuntimeHandler(mock.Object);

            var pluginInvokeArgs = new PluginInvokeArgs
            {
                MethodsToRun      = svc.MethodsToRun,
                PluginConstructor = new PluginConstructor
                {
                    ConstructorName = svc.Constructor.Name,
                    Inputs          = new List <IConstructorParameter>(),
                },
                AssemblyLocation = type.Assembly.Location,
                AssemblyName     = type.Assembly.FullName,
                Fullname         = type.FullName,
            };

            var exception = new Exception("err", new Exception());

            mock.Setup(loader => loader.TryLoadAssembly(It.IsAny <string>(), It.IsAny <string>(), out loadedAssembly))
            .Throws(exception);
            string stringOBj;
            var    run = handler.Test(pluginInvokeArgs, out stringOBj);

            Assert.IsNull(run);
            Assert.IsTrue(string.IsNullOrEmpty(stringOBj));
        }
        public void PluginRuntimeHandler_Test_WhenValid_ExpectRunsCorrectly()
        {
            //------------Setup for test--------------------------

            var type = typeof(Human);
            var svc  = CreatePluginService(new List <IDev2MethodInfo> {
                new Dev2MethodInfo {
                    Method = "EmptyIsNullTest", Parameters = new List <IMethodParameter>()
                }
            }, type, new ServiceConstructor());
            //------------Execute Test---------------------------
            var isolated = new PluginRuntimeHandler();

            var pluginInvokeArgs = new PluginInvokeArgs
            {
                MethodsToRun      = svc.MethodsToRun,
                PluginConstructor = new PluginConstructor
                {
                    ConstructorName = svc.Constructor.Name,
                    Inputs          = new List <IConstructorParameter>(),
                },
                AssemblyLocation = type.Assembly.Location,
                AssemblyName     = type.Assembly.FullName,
                Fullname         = type.FullName,
                Parameters       = new List <MethodParameter>()
                {
                    new MethodParameter()
                    {
                        Name     = "value",
                        TypeName = typeof(string).FullName,
                        Value    = "a"
                    }
                },

                Method = "EmptyIsNullTest"
            };
            string jresult;
            var    instance = isolated.Test(pluginInvokeArgs, out jresult);

            Assert.IsTrue(!string.IsNullOrEmpty(jresult));
            var count = instance.DataSourceShapes.Count;

            Assert.AreEqual(1, count);
        }