示例#1
0
        public async Task When_a_public_void_Main_with_no_parameters_is_present_it_is_invoked()
        {
            var(server, build) = await GetRunnerAndWorkspaceBuild();

            var workspace = Workspace.FromSource(@"
using System;

public static class Hello
{
    public static void Main()
    {
        Console.WriteLine(""Hello there!"");
    }
}", workspaceType: build.Name);

            var result = await server.Run(new WorkspaceRequest(workspace));

            result.ShouldSucceedWithOutput("Hello there!");
        }
        public async Task When_a_public_void_Main_with_parameters_is_present_it_is_invoked()
        {
            var server = GetCodeRunner();

            var workspace = Workspace.FromSource(@"
using System;

public static class Hello
{
    public static void Main(params string[] args)
    {
        Console.WriteLine(""Hello there!"");
    }
}", workspaceType: "console");

            var result = await server.Run(new WorkspaceRequest(workspace));

            result.ShouldSucceedWithOutput("Hello there!");
        }
        public async Task Response_indicates_when_compile_is_successful_and_signature_is_like_a_console_app()
        {
            var server = GetCodeRunner();

            var workspace = Workspace.FromSource(@"
using System;

public static class Hello
{
    public static void Main()
    {
    }
}
", workspaceType: "console");

            var result = await server.Run(new WorkspaceRequest(workspace));

            Log.Trace(result.ToString());

            result.ShouldSucceedWithNoOutput();
        }
示例#4
0
        public async Task When_an_internal_void_Main_with_no_parameters_is_present_it_is_invoked()
        {
            var server = await GetCodeRunnerAsync();

            var workspace = Workspace.FromSource(@"
using System;

public static class Hello
{
    static void Main()
    {
        Console.WriteLine(""Hello there!"");
    }
}", workspaceType:"console");

            var result = await server.Run(new WorkspaceRequest(workspace));

            Log.Trace(result.ToString());

            result.ShouldSucceedWithOutput("Hello there!");
        }
        public async Task Response_shows_program_output_when_compile_is_successful_and_signature_is_like_a_console_app()
        {
            var output = nameof(Response_shows_program_output_when_compile_is_successful_and_signature_is_like_a_console_app);

            var server = GetCodeRunner();

            var workspace = Workspace.FromSource($@"
using System;

public static class Hello
{{
    public static void Main()
    {{
        Console.WriteLine(""{output}"");
    }}
}}", workspaceType: "console");


            var result = await server.Run(new WorkspaceRequest(workspace));

            result.ShouldSucceedWithOutput(output);
        }