Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for dotnet test scenarios #45138

Draft
wants to merge 77 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e120e68
add integration tests
mariam-abdulla Nov 26, 2024
c4e849a
Add some packages
mariam-abdulla Nov 26, 2024
fad998d
Add tests for hybrid mode handling
mariam-abdulla Nov 26, 2024
0e13d3e
Update tests
mariam-abdulla Nov 26, 2024
2231ca9
Add and remove empty lines
mariam-abdulla Nov 26, 2024
8f15feb
Update tests
mariam-abdulla Nov 26, 2024
c739d30
Merge remote-tracking branch 'origin/main' into dev/mabdullah/add-int…
mariam-abdulla Nov 26, 2024
8d5fb09
Fix test project
mariam-abdulla Nov 27, 2024
4f16e31
Replace MicrosoftTestingExtensionsTrxReportVersion with MicrosoftTest…
mariam-abdulla Nov 27, 2024
7365957
remove comment
mariam-abdulla Nov 27, 2024
17a1d31
Replace mstest constant value
mariam-abdulla Nov 27, 2024
9723cd2
Add test for dotnet test --coverage
mariam-abdulla Dec 3, 2024
f57fc16
Update testproject.csproj
mariam-abdulla Dec 3, 2024
362d531
update tests
mariam-abdulla Dec 5, 2024
f18cef6
Merge branch 'main' into dev/mabdullah/add-integration-tests-for-dotn…
mariam-abdulla Dec 5, 2024
3a54918
Read global.json to decide to run in vstest or testing platform mode
mariam-abdulla Dec 11, 2024
0a8086a
remove unused method
mariam-abdulla Dec 11, 2024
e6a4458
Merge branch 'main' into dev/mabdullah/read-globaljson-in-dotnet-test
mariam-abdulla Dec 16, 2024
9b76b5b
Update reading of global.json
mariam-abdulla Dec 16, 2024
1ed22d4
Merge branch 'dev/mabdullah/read-globaljson-in-dotnet-test' of https:…
mariam-abdulla Dec 16, 2024
4ba585b
Update namespace
mariam-abdulla Dec 16, 2024
78971a2
Update var names
mariam-abdulla Dec 16, 2024
f0962da
Add CmdUnsupportedTestRunnerDescription to localizable strings
mariam-abdulla Dec 16, 2024
dbb40af
Merge remote-tracking branch 'origin/main' into dev/mabdullah/add-int…
mariam-abdulla Dec 16, 2024
d63b8a2
Merge branch 'dev/mabdullah/read-globaljson-in-dotnet-test' into dev/…
mariam-abdulla Dec 16, 2024
1d22160
Update tests after global.json update
mariam-abdulla Dec 16, 2024
3faf6e1
Add more tests to validate global.json
mariam-abdulla Dec 17, 2024
e9c2a23
Use msbuild APIs to load projects
mariam-abdulla Jan 3, 2025
e7bcc8a
Add space
mariam-abdulla Jan 3, 2025
5c5e0d1
merge from main
mariam-abdulla Jan 6, 2025
8d747c7
Fix formatting
mariam-abdulla Jan 6, 2025
2b02833
Add comments
mariam-abdulla Jan 6, 2025
0f6ae3b
merge from main
mariam-abdulla Jan 6, 2025
5254d7e
Remove unneeded files
mariam-abdulla Jan 6, 2025
f4cce4e
Update src/Cli/dotnet/commands/dotnet-test/TestingPlatformCommand.cs
mariam-abdulla Jan 6, 2025
f078060
Replace 0 and 1 with constants
mariam-abdulla Jan 6, 2025
4c9add2
Merge branch 'dev/mabdullah/use-msbuild-apis-to-retrieve-project-prop…
mariam-abdulla Jan 6, 2025
771c1f1
Return from InitializeTestApplications() if _areTestingPlatformApplic…
mariam-abdulla Jan 6, 2025
def3cb8
Update method name
mariam-abdulla Jan 6, 2025
3b75ca8
Use aggregator overload in ProcessProjectsInParallel()
mariam-abdulla Jan 6, 2025
8e3b723
Apply some comments
mariam-abdulla Jan 6, 2025
b7b79ef
Remove ?
mariam-abdulla Jan 7, 2025
5349e6c
Update GetSolutionFilePaths
mariam-abdulla Jan 7, 2025
cbc3389
Use Microsoft.VisualStudio.SolutionPersistence namespace to parse sol…
mariam-abdulla Jan 7, 2025
9284893
Add GetSlnFileFullPath and GetProjectFileFullPath methods in Extensio…
mariam-abdulla Jan 7, 2025
6b42f48
Refactor
mariam-abdulla Jan 7, 2025
51c7424
Update ParseSolution to use GetSerializerByMoniker
mariam-abdulla Jan 7, 2025
3855845
Merge branch 'main' into dev/mabdullah/use-msbuild-apis-to-retrieve-p…
mariam-abdulla Jan 8, 2025
33eae8e
Add some tests
mariam-abdulla Jan 8, 2025
082f260
Update src/Cli/dotnet/commands/dotnet-test/TestingPlatformCommand.cs
mariam-abdulla Jan 8, 2025
ae87351
Update src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs
mariam-abdulla Jan 8, 2025
3e26cd3
Update src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs
mariam-abdulla Jan 8, 2025
31593b0
Update src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs
mariam-abdulla Jan 8, 2025
f781164
Update src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs
mariam-abdulla Jan 8, 2025
7e359d1
Merge branch 'main' into dev/mabdullah/use-msbuild-apis-to-retrieve-p…
mariam-abdulla Jan 8, 2025
3c3d56b
Update src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs
mariam-abdulla Jan 8, 2025
55d247d
Apply comments
mariam-abdulla Jan 8, 2025
d3b11c5
merge
mariam-abdulla Jan 8, 2025
41323d4
Update src/Cli/dotnet/commands/dotnet-test/SolutionAndProjectUtility.cs
mariam-abdulla Jan 8, 2025
a774524
Use Lock
mariam-abdulla Jan 8, 2025
9d17be2
Merge branch 'dev/mabdullah/use-msbuild-apis-to-retrieve-project-prop…
mariam-abdulla Jan 8, 2025
3f66a69
Update -bl logic
mariam-abdulla Jan 8, 2025
97b5ae9
Merge branch 'main' into dev/mabdullah/use-msbuild-apis-to-retrieve-p…
mariam-abdulla Jan 8, 2025
4f2b769
Remove unused var
mariam-abdulla Jan 8, 2025
6504a67
Merge branch 'dev/mabdullah/use-msbuild-apis-to-retrieve-project-prop…
mariam-abdulla Jan 8, 2025
c3dc4f2
Support --solution
mariam-abdulla Jan 9, 2025
d96f016
merge
mariam-abdulla Jan 9, 2025
517c20a
refactor code
mariam-abdulla Jan 9, 2025
59136fb
merge
mariam-abdulla Jan 10, 2025
d393e58
merge and add tests for --solution and --directory
mariam-abdulla Jan 13, 2025
d96491d
Merge remote-tracking branch 'origin/main' into dev/mabdullah/add-int…
mariam-abdulla Jan 14, 2025
e009cb8
Fixes
mariam-abdulla Jan 14, 2025
c5fad3d
remove empty line
mariam-abdulla Jan 14, 2025
6f5fd7c
Fix MicrosoftTestingPlatformVersion
mariam-abdulla Jan 14, 2025
fed7822
Remove unused prop
mariam-abdulla Jan 14, 2025
17705c2
Update csproj files
mariam-abdulla Jan 14, 2025
e82c529
remove unused files
mariam-abdulla Jan 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,10 @@
<Dependency Name="MSTest" Version="3.8.0-preview.25057.8">
<Uri>https://github.com/microsoft/testfx</Uri>
<Sha>53488cf463d33882113ca7a6fbbb6f93e06251df</Sha>
</Dependency>
<Dependency Name="Microsoft.Testing.Platform" Version="1.6.0-preview.25059.14">
<Uri>https://github.com/microsoft/testfx</Uri>
<Sha>53488cf463d33882113ca7a6fbbb6f93e06251df</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<UsingToolMicrosoftNetCompilers Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</UsingToolMicrosoftNetCompilers>
<MicrosoftIORedistPackageVersion>6.0.1</MicrosoftIORedistPackageVersion>
<FlagNetStandard1XDependencies Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</FlagNetStandard1XDependencies>
<MicrosoftTestingPlatformVersion>1.6.0-preview.25059.14</MicrosoftTestingPlatformVersion>
</PropertyGroup>
<PropertyGroup Label="Servicing version information">
<VersionFeature21>30</VersionFeature21>
Expand Down
Empty file modified eng/common/cross/build-rootfs.sh
100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion src/Cli/dotnet/commands/dotnet-test/MSBuildHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,10 @@ private static BuildResult RestoreProject(string projectFilePath, ProjectCollect
return buildResult;
}

private static bool IsBinaryLoggerEnabled(List<string> args, out string binLogFileName)
internal static bool IsBinaryLoggerEnabled(List<string> args, out string binLogFileName)
{
binLogFileName = string.Empty;

var binLogArgs = new List<string>();

foreach (var arg in args)
Expand Down
4 changes: 2 additions & 2 deletions src/Cli/dotnet/commands/dotnet-test/TestApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private ProcessStartInfo CreateProcessStartInfo(bool hasFilterMode, bool isDll,
private void WaitOnTestApplicationPipeConnectionLoop()
{
_cancellationToken.Cancel();
_testAppPipeConnectionLoop.Wait((int)TimeSpan.FromSeconds(30).TotalMilliseconds);
_testAppPipeConnectionLoop?.Wait((int)TimeSpan.FromSeconds(30).TotalMilliseconds);
}

private async Task WaitConnectionAsync(CancellationToken token)
Expand Down Expand Up @@ -212,7 +212,7 @@ private async Task<int> StartProcess(ProcessStartInfo processStartInfo)
{
if (VSTestTrace.TraceEnabled)
{
VSTestTrace.SafeWriteTrace(() => $"Updated args: {processStartInfo.Arguments}");
VSTestTrace.SafeWriteTrace(() => $"Test application arguments: {processStartInfo.Arguments}");
}

var process = Process.Start(processStartInfo);
Expand Down
49 changes: 36 additions & 13 deletions src/Cli/dotnet/commands/dotnet-test/TestCommandParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.CommandLine;
using System.Text.Json;
using System.Text.Json.Nodes;
using Microsoft.DotNet.Tools.Test;
using Microsoft.NET.Sdk.WorkloadManifestReader;
using LocalizableStrings = Microsoft.DotNet.Tools.Test.LocalizableStrings;

namespace Microsoft.DotNet.Cli
Expand Down Expand Up @@ -152,38 +155,58 @@ private static CliOption<string> CreateBlameHangDumpOption()

private static readonly CliCommand Command = ConstructCommand();



public static CliCommand GetCommand()
{
return Command;
}

private static bool IsTestingPlatformEnabled()
private static string GetTestRunnerName()
{
var testingPlatformEnabledEnvironmentVariable = Environment.GetEnvironmentVariable("DOTNET_CLI_TESTINGPLATFORM_ENABLE");
var isTestingPlatformEnabled = testingPlatformEnabledEnvironmentVariable == "1" || string.Equals(testingPlatformEnabledEnvironmentVariable, "true", StringComparison.OrdinalIgnoreCase);
return isTestingPlatformEnabled;
string defaultTestRunnerName = CliConstants.VSTest;

string? globalJsonPath = SdkDirectoryWorkloadManifestProvider.GetGlobalJsonPath(Environment.CurrentDirectory);

if (!string.IsNullOrEmpty(globalJsonPath))
{
JsonNode globalJson = JsonObject.Parse(File.ReadAllText(globalJsonPath));
JsonNode? testSection = globalJson[CliConstants.TestSectionKey];

if (testSection is null)
{
return defaultTestRunnerName;
}

JsonSerializerOptions JsonSerializerOptions = new JsonSerializerOptions
{
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
var testSettings = JsonSerializer.Deserialize<TestSettings>(testSection, JsonSerializerOptions);

if (testSettings?.Runner?.Name is not null)
{
return testSettings.Runner.Name;
}
}
return defaultTestRunnerName;
}

private static CliCommand ConstructCommand()
{
#if RELEASE
return GetVSTestCliCommand();
#else
bool isTestingPlatformEnabled = IsTestingPlatformEnabled();
string testingSdkName = isTestingPlatformEnabled ? "testingplatform" : "vstest";
string testRunnerName = GetTestRunnerName();

if (isTestingPlatformEnabled)
if (testRunnerName.Equals(CliConstants.VSTest, StringComparison.OrdinalIgnoreCase))
{
return GetTestingPlatformCliCommand();
return GetVSTestCliCommand();
}
else
else if (testRunnerName.Equals(CliConstants.MicrosoftTestingPlatform, StringComparison.OrdinalIgnoreCase))
{
return GetVSTestCliCommand();
return GetTestingPlatformCliCommand();
}

throw new InvalidOperationException($"Testing sdk not supported: {testingSdkName}");
throw new InvalidOperationException(string.Format(LocalizableStrings.CmdUnsupportedTestRunnerDescription, testRunnerName));
#endif
}

Expand Down
8 changes: 8 additions & 0 deletions src/Cli/dotnet/commands/dotnet-test/TestSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.DotNet.Cli
{
internal sealed record TestSettings(Runner? Runner);
internal sealed record Runner(string Name);
}
6 changes: 6 additions & 0 deletions test/Microsoft.NET.TestFramework/Commands/TestCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ public TestCommand WithTraceOutput()
return this;
}

public TestCommand WithEnableTestingPlatform()
{
WithEnvironmentVariable("DOTNET_CLI_TESTINGPLATFORM_ENABLE", "1");
return this;
}

private SdkCommandSpec CreateCommandSpec(IEnumerable<string> args)
{
var commandSpec = CreateCommand(args);
Expand Down
7 changes: 7 additions & 0 deletions test/TestAssets/TestProjects/EmptyFolder/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"test" : {
"runner": {
"name": "MicrosoftTestingPlatform"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest" Version="$(MSTestVersion)" />
</ItemGroup>

<ItemGroup>
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace AnotherTestProject
{
[TestClass]
public sealed class Test1
{
[TestMethod]
public void TestMethod1()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35415.258
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProject", "TestProject\TestProject.csproj", "{702EE852-C8D1-4A85-B3A9-3968AD9A735F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OtherTestProject", "OtherTestProject\OtherTestProject.csproj", "{8683AE78-764B-46C2-98D4-8A3031CBA27E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnotherTestProject", "AnotherTestProject\AnotherTestProject.csproj", "{2604B2BA-D36A-461D-9BB3-207E4253051C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{702EE852-C8D1-4A85-B3A9-3968AD9A735F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{702EE852-C8D1-4A85-B3A9-3968AD9A735F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{702EE852-C8D1-4A85-B3A9-3968AD9A735F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{702EE852-C8D1-4A85-B3A9-3968AD9A735F}.Release|Any CPU.Build.0 = Release|Any CPU
{8683AE78-764B-46C2-98D4-8A3031CBA27E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8683AE78-764B-46C2-98D4-8A3031CBA27E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8683AE78-764B-46C2-98D4-8A3031CBA27E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8683AE78-764B-46C2-98D4-8A3031CBA27E}.Release|Any CPU.Build.0 = Release|Any CPU
{2604B2BA-D36A-461D-9BB3-207E4253051C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2604B2BA-D36A-461D-9BB3-207E4253051C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2604B2BA-D36A-461D-9BB3-207E4253051C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2604B2BA-D36A-461D-9BB3-207E4253051C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), testAsset.props))\testAsset.props" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsTestProject>true</IsTestProject>
<IsTestingPlatformApplication>true</IsTestingPlatformApplication>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Testing.Platform" Version="$(MicrosoftTestingPlatformVersion)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
//See https://aka.ms/new-console-template for more information

//Opt -out telemetry

using Microsoft.Testing.Platform.Builder;
using Microsoft.Testing.Platform.Capabilities.TestFramework;
using Microsoft.Testing.Platform.Extensions.Messages;
using Microsoft.Testing.Platform.Extensions.TestFramework;

var testApplicationBuilder = await TestApplication.CreateBuilderAsync(args);

//testApplicationBuilder.AddMSTest(() => new[] { Assembly.GetEntryAssembly()! });
testApplicationBuilder.RegisterTestFramework(_ => new TestFrameworkCapabilities(), (_, __) => new DummyTestAdapter());

using var testApplication = await testApplicationBuilder.BuildAsync();
return await testApplication.RunAsync();

public class DummyTestAdapter : ITestFramework, IDataProducer
{
public string Uid => nameof(DummyTestAdapter);

public string Version => "2.0.0";

public string DisplayName => nameof(DummyTestAdapter);

public string Description => nameof(DummyTestAdapter);

public Task<bool> IsEnabledAsync() => Task.FromResult(true);

public Type[] DataTypesProduced => new[] {
typeof(TestNodeUpdateMessage),
typeof(SessionFileArtifact),
typeof(TestNodeFileArtifact),
typeof(FileArtifact), };

public Task<CreateTestSessionResult> CreateTestSessionAsync(CreateTestSessionContext context)
=> Task.FromResult(new CreateTestSessionResult() { IsSuccess = true });

public Task<CloseTestSessionResult> CloseTestSessionAsync(CloseTestSessionContext context)
=> Task.FromResult(new CloseTestSessionResult() { IsSuccess = true });

public async Task ExecuteRequestAsync(ExecuteRequestContext context)
{
await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test0",
DisplayName = "Test0",
Properties = new PropertyBag(new DiscoveredTestNodeStateProperty()),
}));

await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test0",
DisplayName = "Test0",
Properties = new PropertyBag(new PassedTestNodeStateProperty("OK")),
}));

await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test1",
DisplayName = "Test1",
Properties = new PropertyBag(new SkippedTestNodeStateProperty("OK skipped!")),
}));

await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test2",
DisplayName = "Test2",
Properties = new PropertyBag(new FailedTestNodeStateProperty(new Exception("this is a failed test"), "not OK")),
}));

await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test3",
DisplayName = "Test3",
Properties = new PropertyBag(new TimeoutTestNodeStateProperty(new Exception("this is a timeout exception"), "not OK")),
}));

await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test4",
DisplayName = "Test4",
Properties = new PropertyBag(new ErrorTestNodeStateProperty(new Exception("this is an exception"), "not OK")),
}));

await context.MessageBus.PublishAsync(this, new TestNodeUpdateMessage(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test5",
DisplayName = "Test5",
Properties = new PropertyBag(new CancelledTestNodeStateProperty(new Exception("this is a cancelled exception"), "not OK")),
}));

await context.MessageBus.PublishAsync(this, new FileArtifact(new FileInfo("file.txt"), "file", "file description"));

await context.MessageBus.PublishAsync(this, new SessionFileArtifact(context.Request.Session.SessionUid, new FileInfo("sessionFile.txt"), "sessionFile", "description"));

await context.MessageBus.PublishAsync(this, new TestNodeFileArtifact(context.Request.Session.SessionUid, new TestNode()
{
Uid = "Test6 id",
DisplayName = "Test6",
Properties = new PropertyBag(new PassedTestNodeStateProperty("OK")),
}, new FileInfo("testNodeFile.txt"), "testNodeFile", "description"));
//await Task.CompletedTask;
context.Complete();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TestProject
{
[TestClass]
public sealed class Test1
{
[TestMethod]
public void TestMethod4()
{
Assert.AreEqual(1, 1);
}

[TestMethod]
public void TestMethod5()
{
Assert.AreEqual(2, 2);
}

[TestMethod]
public void TestMethod6()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="MSTest.Sdk/$(MSTestVersion)">

<PropertyGroup>
<TargetFramework>net8</TargetFramework>
<EnableMicrosoftTestingExtensionsCodeCoverage>False</EnableMicrosoftTestingExtensionsCodeCoverage>
</PropertyGroup>

<!-- references to the code to test -->

</Project>
Loading
Loading