1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
4
+ using Microsoft . Testing . Extensions . AzureDevOps ;
5
+ using Microsoft . Testing . Extensions . AzureDevOps . Resources ;
4
6
using Microsoft . Testing . Extensions . Reporting ;
5
- using Microsoft . Testing . Extensions . Reporting . Resources ;
6
7
using Microsoft . Testing . Platform ;
7
8
using Microsoft . Testing . Platform . CommandLine ;
8
9
using Microsoft . Testing . Platform . Extensions . Messages ;
@@ -65,10 +66,7 @@ public Task<bool> IsEnabledAsync()
65
66
bool found = _commandLine . TryGetOptionArgumentList ( AzureDevOpsCommandLineOptions . AzureDevOpsReportSeverity , out string [ ] ? arguments ) ;
66
67
if ( found && arguments ? . Length > 0 )
67
68
{
68
- if ( string . Equals ( arguments [ 0 ] , "warning" , StringComparison . OrdinalIgnoreCase ) )
69
- {
70
- _severity = "warning" ;
71
- }
69
+ _severity = arguments [ 0 ] . ToLowerInvariant ( ) ;
72
70
}
73
71
}
74
72
@@ -82,36 +80,27 @@ public async Task ConsumeAsync(IDataProducer dataProducer, IData value, Cancella
82
80
return ;
83
81
}
84
82
85
- try
83
+ if ( value is not TestNodeUpdateMessage nodeUpdateMessage )
86
84
{
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
-
110
85
return ;
111
86
}
112
- catch ( OperationCanceledException ex ) when ( ex . CancellationToken == cancellationToken )
87
+
88
+ TestNodeStateProperty nodeState = nodeUpdateMessage . TestNode . Properties . Single < TestNodeStateProperty > ( ) ;
89
+
90
+ switch ( nodeState )
113
91
{
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 ;
115
104
}
116
105
117
106
return ;
0 commit comments