Пример #1
0
        public void It_can_run_a_private_main_method()
        {
            /* Compiled from
             * using System;
             * namespace myApp
             * {
             * class Program
             * {
             * static void Main()
             * {
             * Console.WriteLine("Hello World!");
             * }
             * }
             * }
             */
            using (var consoleState = new PreserveConsoleState())
            {
                var assembly   = @"TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAECAG+WAqcAAAAAAAAAAOAAIiALATAAAAYAAAACAAAAAAAAYiUAAAAgAAAAQAAAAAAAEAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAABgAAAAAgAAAAAAAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAABAlAABPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAwAAAD0JAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAACCAAAEgAAAAAAAAAAAAAAC50ZXh0AAAAaAUAAAAgAAAABgAAAAIAAAAAAAAAAAAAAAAAACAAAGAucmVsb2MAAAwAAAAAQAAAAAIAAAAIAAAAAAAAAAAAAAAAAABAAABCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEJQAAAAAAAEgAAAACAAUAcCAAAIQEAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADYAcgEAAHAoCgAACgAqIgIoCwAACgAqIgIoCwAACgAqQlNKQgEAAQAAAAAADAAAAHY0LjAuMzAzMTkAAAAABQBsAAAAhAEAACN+AADwAQAA2AEAACNTdHJpbmdzAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
                var runRequest = new WasmCodeRunnerRequest()
                {
                    Base64Assembly = assembly,
                    Succeeded      = true
                };

                var theThing = new InteropMessage <WasmCodeRunnerRequest>(123, runRequest);
                var message  = JObject.FromObject(theThing).ToString();

                var result = CodeRunner.ProcessRunRequest(message);

                result.Sequence.Should().Be(123);
                result.Data.Output.Select(o => o.Trim()).Should().BeEquivalentTo("Hello World!", "");
                consoleState.OutputIsRedirected.Should().BeFalse();
            }
        }
Пример #2
0
        public void It_can_run_code_and_return_result_with_correct_sequence_number()
        {
            using (var consoleState = new PreserveConsoleState())
            {
                var assembly   = @"TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAECAPwuRL8AAAAAAAAAAOAAIgALATAAAA4AAAACAAAAAAAAfiwAAAAgAAAAQAAAAABAAAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAABgAAAAAgAAAAAAAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAACwsAABPAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
                var runRequest = new WasmCodeRunnerRequest()
                {
                    Base64Assembly = assembly,
                    Succeeded      = true
                };

                var theThing = new InteropMessage <WasmCodeRunnerRequest>(123, runRequest);

                var message = JObject.FromObject(theThing).ToString();

                var result = CodeRunner.ProcessRunRequest(message);

                result.Sequence.Should().Be(123);
                result.Data.CodeRunnerVersion.Should().NotBeNullOrEmpty();
                result.Data.Output.Select(o => o.Replace("\r\n", "\n")).Should().BeEquivalentTo(
                    "1", "1", "2", "3", "5", "8", "13", "21",
                    "34", "55", "89", "144", "233", "377", "610",
                    "987", "1597", "2584", "4181", "6765", "");

                consoleState.OutputIsRedirected.Should().BeFalse();
            }
        }
Пример #3
0
 public void It_returns_null_if_there_is_no_assembly_or_diagnostics()
 {
     using (var consoleState = new PreserveConsoleState())
     {
         var runRequest     = new WasmCodeRunnerRequest();
         var interopMessage = new InteropMessage <WasmCodeRunnerRequest>(0, runRequest);
         var text           = JObject.FromObject(interopMessage).ToString();
         CodeRunner.ProcessRunRequest(text).Should().Be(null);
         consoleState.OutputIsRedirected.Should().BeFalse();
     }
 }
Пример #4
0
        public static async Task <bool> PostMessageAsync(string message)
        {
            try
            {
                var result = CodeRunner.ProcessRunRequest(message);
                if (result != null)
                {
                    await PostMessage(JObject.FromObject(result).ToString());
                }
            }
            catch
            {
            }

            return(true);
        }
Пример #5
0
        public void It_can_convert_diagnostics_into_output()
        {
            using (var consoleState = new PreserveConsoleState())
            {
                var diagnostic = new SerializableDiagnostic(0, 1, "message", 2, "stuff2");
                var runRequest = new WasmCodeRunnerRequest()
                {
                    Diagnostics = new[] { diagnostic },
                    Succeeded   = false
                };

                var theThing = new InteropMessage <WasmCodeRunnerRequest>(123, runRequest);
                var message  = JObject.FromObject(theThing).ToString();

                var result = CodeRunner.ProcessRunRequest(message);

                result.Sequence.Should().Be(123);
                result.Data.Output.Should().BeEquivalentTo("message");
                result.Data.Diagnostics.Should().BeNullOrEmpty();
                consoleState.OutputIsRedirected.Should().BeFalse();
            }
        }
Пример #6
0
        public void It_can_run_a_Main_method_that_takes_string_array_with_dashdash_arguments()
        {
            /* Compiled from
             *
             *          using System;
             *          using System.Collections.Generic;
             *          using System.Linq;
             * namespace myApp
             *  {
             *      class Program
             *      {
             *          static void Main(string[] args)
             *          {
             *              Console.WriteLine(string.Join("" "", args.Reverse()));
             *          }
             *      }
             *  }
             */
            using (var consoleState = new PreserveConsoleState())
            {
                var assembly   = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAECALX0yL0AAAAAAAAAAOAAIiALATAAAAgAAAACAAAAAAAABiYAAAAgAAAAQAAAAAAAEAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAABgAAAAAgAAAAAAAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAALQlAABPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
                var runRequest = new WasmCodeRunnerRequest()
                {
                    Base64Assembly = assembly,
                    Succeeded      = true,
                    RunArgs        = "--region region1 --session sessionOne"
                };

                var theThing = new InteropMessage <WasmCodeRunnerRequest>(123, runRequest);
                var message  = JObject.FromObject(theThing).ToString();

                var result = CodeRunner.ProcessRunRequest(message);

                result.Sequence.Should().Be(123);
                result.Data.Output.Select(o => o.Trim()).Should().BeEquivalentTo("sessionOne --session region1 --region", "");
                consoleState.OutputIsRedirected.Should().BeFalse();
            }
        }
Пример #7
0
        public void It_can_run_a_Main_method_that_takes_string_array_forwarding_the_arg_to_running_code()
        {
            /* Compiled from
             * using System;
             * using System.Collections.Generic;
             * using System.Linq;
             * namespace myApp
             * {
             * class Program
             * {
             *    static void Main(string[] args)
             *    {
             *        Console.WriteLine(string.Join(", and then ", args.Reverse()));
             *    }
             * }
             * }
             */
            using (var consoleState = new PreserveConsoleState())
            {
                var assembly   = @"TVqQAAMAAAAEAAAA//8A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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAMAAAAHDYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
                var runRequest = new WasmCodeRunnerRequest()
                {
                    Base64Assembly = assembly,
                    Succeeded      = true,
                    RunArgs        = "first second \"third argument\""
                };

                var theThing = new InteropMessage <WasmCodeRunnerRequest>(123, runRequest);
                var message  = JObject.FromObject(theThing).ToString();

                var result = CodeRunner.ProcessRunRequest(message);

                result.Sequence.Should().Be(123);
                result.Data.Output.Select(o => o.Trim()).Should().BeEquivalentTo("third argument, and then second, and then first", "");
                consoleState.OutputIsRedirected.Should().BeFalse();
            }
        }
Пример #8
0
        public void It_can_run_a_Main_method_with_missing_arguments()
        {
            /* Compiled form
             *          using System;
             *          using System.Collections.Generic;
             *          using System.Linq;
             * namespace myApp
             *  {
             *      class Program
             *      {
             *          static void Main(string region)
             *          {
             *              Console.WriteLine($"region {region}");
             *          }
             *      }
             *  }
             */
            using (var consoleState = new PreserveConsoleState())
            {
                var assembly   = "TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAECAKUKHa4AAAAAAAAAAOAAIiALATAAAAYAAAACAAAAAAAAliUAAAAgAAAAQAAAAAAAEAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAABgAAAAAgAAAAAAAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAEQlAABPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAwAAAAoJQAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAACCAAAEgAAAAAAAAAAAAAAC50ZXh0AAAAnAUAAAAgAAAABgAAAAIAAAAAAAAAAAAAAAAAACAAAGAucmVsb2MAAAwAAAAAQAAAAAIAAAAIAAAAAAAAAAAAAAAAAABAAABCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4JQAAAAAAAEgAAAACAAUAeCAAALAEAAABAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
                var runRequest = new WasmCodeRunnerRequest()
                {
                    Base64Assembly = assembly,
                    Succeeded      = true,
                    RunArgs        = "--region region1 --session sessionOne"
                };

                var theThing = new InteropMessage <WasmCodeRunnerRequest>(123, runRequest);
                var message  = JObject.FromObject(theThing).ToString();

                var result = CodeRunner.ProcessRunRequest(message);

                result.Sequence.Should().Be(123);
                result.Data.Output.Select(o => o.Trim()).Should().BeEquivalentTo("region region1", "");
                consoleState.OutputIsRedirected.Should().BeFalse();
            }
        }
Пример #9
0
        public void It_can_run_a_Main_method_that_requires_argument_bindings()
        {
            /* Compiled from
             * using System;
             * using System.Collections.Generic;
             * using System.Linq;
             * namespace myApp
             * {
             * class Program
             * {
             *    static void Main(string region, string session)
             *    {
             *        Console.WriteLine($"region {region} session {session}");
             *    }
             * }
             * }
             */
            using (var consoleState = new PreserveConsoleState())
            {
                var assembly   = @"TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==";
                var runRequest = new WasmCodeRunnerRequest()
                {
                    Base64Assembly = assembly,
                    Succeeded      = true,
                    RunArgs        = "--region region1 --session sessionOne"
                };

                var theThing = new InteropMessage <WasmCodeRunnerRequest>(123, runRequest);
                var message  = JObject.FromObject(theThing).ToString();

                var result = CodeRunner.ProcessRunRequest(message);

                result.Sequence.Should().Be(123);
                result.Data.Output.Select(o => o.Trim()).Should().BeEquivalentTo("region region1 session sessionOne", "");
                consoleState.OutputIsRedirected.Should().BeFalse();
            }
        }