Skip to content

Commit fe56275

Browse files
committed
Pr review feedbacks
1 parent 4435ad1 commit fe56275

File tree

4 files changed

+26
-40
lines changed

4 files changed

+26
-40
lines changed

src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsCommandLineProvider.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
using Microsoft.Testing.Extensions.Reporting.Resources;
4+
using Microsoft.Testing.Extensions.AzureDevOps.Resources;
55
using Microsoft.Testing.Platform.CommandLine;
66
using Microsoft.Testing.Platform.Extensions;
77
using Microsoft.Testing.Platform.Extensions.CommandLine;

src/Platform/Microsoft.Testing.Extensions.AzureDevOps/AzureDevOpsReporter.cs

+20-31
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using Microsoft.Testing.Extensions.AzureDevOps;
5+
using Microsoft.Testing.Extensions.AzureDevOps.Resources;
46
using Microsoft.Testing.Extensions.Reporting;
5-
using Microsoft.Testing.Extensions.Reporting.Resources;
67
using Microsoft.Testing.Platform;
78
using Microsoft.Testing.Platform.CommandLine;
89
using Microsoft.Testing.Platform.Extensions.Messages;
@@ -65,10 +66,7 @@ public Task<bool> IsEnabledAsync()
6566
bool found = _commandLine.TryGetOptionArgumentList(AzureDevOpsCommandLineOptions.AzureDevOpsReportSeverity, out string[]? arguments);
6667
if (found && arguments?.Length > 0)
6768
{
68-
if (string.Equals(arguments[0], "warning", StringComparison.OrdinalIgnoreCase))
69-
{
70-
_severity = "warning";
71-
}
69+
_severity = arguments[0].ToLowerInvariant();
7270
}
7371
}
7472

@@ -82,36 +80,27 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella
8280
return;
8381
}
8482

85-
try
83+
if (value is not TestNodeUpdateMessage nodeUpdateMessage)
8684
{
87-
if (value is not TestNodeUpdateMessage nodeUpdateMessage)
88-
{
89-
return;
90-
}
91-
92-
TestNodeStateProperty nodeState = nodeUpdateMessage.TestNode.Properties.Single<TestNodeStateProperty>();
93-
94-
switch (nodeState)
95-
{
96-
case FailedTestNodeStateProperty failed:
97-
await WriteExceptionAsync(failed.Explanation, failed.Exception);
98-
break;
99-
case ErrorTestNodeStateProperty error:
100-
await WriteExceptionAsync(error.Explanation, error.Exception);
101-
break;
102-
case CancelledTestNodeStateProperty cancelled:
103-
await WriteExceptionAsync(cancelled.Explanation, cancelled.Exception);
104-
break;
105-
case TimeoutTestNodeStateProperty timeout:
106-
await WriteExceptionAsync(timeout.Explanation, timeout.Exception);
107-
break;
108-
}
109-
11085
return;
11186
}
112-
catch (OperationCanceledException ex) when (ex.CancellationToken == cancellationToken)
87+
88+
TestNodeStateProperty nodeState = nodeUpdateMessage.TestNode.Properties.Single<TestNodeStateProperty>();
89+
90+
switch (nodeState)
11391
{
114-
// Do nothing, we're stopping
92+
case FailedTestNodeStateProperty failed:
93+
94+
break;
95+
case ErrorTestNodeStateProperty error:
96+
await WriteExceptionAsync(error.Explanation, error.Exception);
97+
break;
98+
case CancelledTestNodeStateProperty cancelled:
99+
await WriteExceptionAsync(cancelled.Explanation, cancelled.Exception);
100+
break;
101+
case TimeoutTestNodeStateProperty timeout:
102+
await WriteExceptionAsync(timeout.Explanation, timeout.Exception);
103+
break;
115104
}
116105

117106
return;

src/Platform/Microsoft.Testing.Extensions.AzureDevOps/Microsoft.Testing.Extensions.AzureDevOps.csproj

+4-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0;$(MicrosoftTestingTargetFrameworks)</TargetFrameworks>
5-
<RootNamespace>Microsoft.Testing.Extensions.Reporting</RootNamespace>
5+
6+
<!-- Stay on 1.0.0 alpha while we are dogfooding this extension to see if it is useful. -->
7+
<VersionPrefix>1.0.0</VersionPrefix>
8+
<PreReleaseVersionLabel>alpha</PreReleaseVersionLabel>
69
</PropertyGroup>
710

811
<!-- NuGet properties -->
@@ -39,12 +42,6 @@ This package extends Microsoft Testing Platform to provide a Azure DevOps report
3942
<ProjectReference Include="$(RepoRoot)src\Platform\Microsoft.Testing.Platform\Microsoft.Testing.Platform.csproj" />
4043
</ItemGroup>
4144

42-
<ItemGroup>
43-
<InternalsVisibleTo Include="Microsoft.Testing.Extensions.VSTestBridge" Key="$(VsPublicKey)" />
44-
<InternalsVisibleTo Include="Microsoft.Testing.Extensions.HangDump" Key="$(VsPublicKey)" />
45-
<InternalsVisibleTo Include="Microsoft.Testing.Extensions.UnitTests" Key="$(VsPublicKey)" />
46-
</ItemGroup>
47-
4845
<ItemGroup>
4946
<EmbeddedResource Update="Resources\AzureDevOpsResources.resx" GenerateSource="true" />
5047
</ItemGroup>

src/Platform/Microsoft.Testing.Extensions.AzureDevOps/RootFinder.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4-
namespace Microsoft.Testing.Extensions.TrxReport.Abstractions;
4+
namespace Microsoft.Testing.Extensions.AzureDevOps;
55

66
internal static class RootFinder
77
{

0 commit comments

Comments
 (0)