Пример #1
0
        public void It_returns_an_error_if_there_is_no_entry_point()
        {
            using (var consoleState = new PreserveConsoleState())
            {
                var compilation = Compile("class C {}");

                using (var stream = new MemoryStream())
                {
                    compilation.Emit(peStream: stream);
                    var encodedAssembly = Convert.ToBase64String(stream.ToArray());

                    var runRequest = new WasmCodeRunnerRequest()
                    {
                        Succeeded      = true,
                        Base64Assembly = encodedAssembly
                    };

                    var output = new CodeRunner().ExecuteRunRequest(runRequest, 1).Data.Output;
                    output.Single().Should().Be("error CS5001: Program does not contain a static 'Main' method suitable for an entry point");
                    consoleState.OutputIsRedirected.Should().BeFalse();
                }
            }
        }