コード例 #1
0
ファイル: SimpleSample.cs プロジェクト: andyhebear/NScripto
        public void HelloWorld()
        {
            var scriptApi = new ScriptApi();
            var script = scriptApi.CompileScript<HelloWorldEnvironment>("DoIt()");

            var environment = new HelloWorldEnvironment();
            script.Run(environment);

            environment.Result.ShouldEqual("Hello World!");
        }
コード例 #2
0
        public void HelloWorld()
        {
            var scriptApi = new ScriptApi();
            var script    = scriptApi.CompileScript <HelloWorldEnvironment>("DoIt()");

            var environment = new HelloWorldEnvironment();

            script.Run(environment);

            environment.Result.ShouldEqual("Hello World!");
        }
コード例 #3
0
        public void MultipleEnvironments()
        {
            var scriptApi = new ScriptApi();
            var script    = scriptApi.CompileScript <HelloWorldEnvironment, GeneralPurposeEnvironment>("DoIt(GetRandom(42))");

            var helloEnvironment   = new HelloWorldEnvironment();
            var generalEnvironment = new GeneralPurposeEnvironment();

            script.Run(helloEnvironment, generalEnvironment);

            helloEnvironment.Result.ShouldEqual("Hello 28!");
        }