-
Notifications
You must be signed in to change notification settings - Fork 264
/
Copy pathUnitTestOutcomeHelper.cs
50 lines (43 loc) · 1.83 KB
/
UnitTestOutcomeHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Helpers
{
using Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
internal static class UnitTestOutcomeHelper
{
/// <summary>
/// Converts the parameter unitTestOutcome to testOutcome
/// </summary>
/// <param name="unitTestOutcome"> The unit Test Outcome. </param>
/// <param name="mapInconclusiveToFailed">Should map inconclusive to failed.</param>
/// <returns>The Test platforms outcome.</returns>
internal static TestOutcome ToTestOutcome(UnitTestOutcome unitTestOutcome, bool mapInconclusiveToFailed)
{
switch (unitTestOutcome)
{
case UnitTestOutcome.Passed:
return TestOutcome.Passed;
case UnitTestOutcome.Failed:
case UnitTestOutcome.Error:
case UnitTestOutcome.NotRunnable:
case UnitTestOutcome.Timeout:
return TestOutcome.Failed;
case UnitTestOutcome.Ignored:
return TestOutcome.Skipped;
case UnitTestOutcome.Inconclusive:
{
if (mapInconclusiveToFailed)
{
return TestOutcome.Failed;
}
return TestOutcome.Skipped;
}
case UnitTestOutcome.NotFound:
return TestOutcome.NotFound;
default:
return TestOutcome.None;
}
}
}
}