7630337074
Adding a message handler for the version check message. Also introduced an IDotnetTest that handles state and handlers (the state machine). Adding the test discover start message handler and introducing a test runner. Added the handler for the GetTestRunnerProcessInfo message. Also, modified dotnet test to have separate setter for the special message handlers for terminate and unknown messages and added a separate method to add new reporting channels to DotnetTest, so that it can handle the new listener for the test runner. Added the test runner test discovery handlers. Added handlers to deal with the test execution itself. Updated dotnet-test program to use the message handlers during design time. Added a test for the whole discover tests message flow. Added a test for the run tests full message exchange.
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
using System.Collections.Generic;
|
|
using FluentAssertions;
|
|
using Microsoft.DotNet.Tools.Test;
|
|
using Microsoft.Extensions.Testing.Abstractions;
|
|
using Newtonsoft.Json.Linq;
|
|
using Xunit;
|
|
|
|
namespace Microsoft.Dotnet.Tools.Test.Tests
|
|
{
|
|
public class GivenARunTestsArgumentsBuilder
|
|
{
|
|
[Fact]
|
|
public void It_generates_the_right_arguments_for_RunTests()
|
|
{
|
|
const int port = 1;
|
|
const string assembly = "assembly.dll";
|
|
|
|
var message = new Message
|
|
{
|
|
Payload = JToken.FromObject(new RunTestsMessage { Tests = new List<string> { "test1", "test2" } })
|
|
};
|
|
|
|
var runTestsArgumentsBuilder = new RunTestsArgumentsBuilder(assembly, port, message);
|
|
|
|
var arguments = runTestsArgumentsBuilder.BuildArguments();
|
|
|
|
arguments.Should().BeEquivalentTo(
|
|
assembly,
|
|
"--designtime",
|
|
"--port",
|
|
$"{port}",
|
|
"--test",
|
|
"test1",
|
|
"--test",
|
|
"test2");
|
|
}
|
|
}
|
|
}
|