Ejemplo n.º 1
0
        public void TestRunExpression()
        {
            var handler = new CSScriptHandler();
            var rr      = new RunRequest
            {
                Kind = ScriptKind.Expression,
                Code = @" 
                        System.Environment.OSVersion.Platform
                        "
            };
            var rsp = handler.Process(rr) as RunResponse;

            Assert.AreEqual("Win32NT", rsp.Result + "");
        }
Ejemplo n.º 2
0
        public void TestRunMethod()
        {
            var handler = new CSScriptHandler();
            var rr      = new RunRequest
            {
                Kind = ScriptKind.Method,
                Code = @" 
                        public object Run(params object[] args)
                        {
                            return System.Environment.OSVersion.Platform;
                        }                        
                        "
            };
            var rsp = handler.Process(rr) as RunResponse;

            Assert.AreEqual("Win32NT", rsp.Result + "");
        }
Ejemplo n.º 3
0
        public void TestRunClass()
        {
            var handler = new CSScriptHandler();
            var rr      = new RunRequest
            {
                Kind = ScriptKind.Class,
                Code = @"
                         using System;
                         using Stinkhorn.Script.API;

                         public class Example : MarshalByRefObject, IRunnable 
                         {
                            public object Run(params object[] args)
                            {
                                return System.Environment.OSVersion.Platform;
                            }
                         }
                        "
            };
            var rsp = handler.Process(rr) as RunResponse;

            Assert.AreEqual("Win32NT", rsp.Result + "");
        }