diff options
Diffstat (limited to '')
| -rw-r--r-- | src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactTestCase.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactTestCase.cs b/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactTestCase.cs new file mode 100644 index 00000000..f13fec83 --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactTestCase.cs | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixBuildTools.TestSupport.XunitExtensions | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.ComponentModel; | ||
| 7 | using System.Threading; | ||
| 8 | using System.Threading.Tasks; | ||
| 9 | using Xunit.Abstractions; | ||
| 10 | using Xunit.Sdk; | ||
| 11 | |||
| 12 | public class SkippableFactTestCase : XunitTestCase | ||
| 13 | { | ||
| 14 | [EditorBrowsable(EditorBrowsableState.Never)] | ||
| 15 | [Obsolete("Called by the de-serializer; should only be called by deriving classes for de-serialization purposes")] | ||
| 16 | public SkippableFactTestCase() { } | ||
| 17 | |||
| 18 | public SkippableFactTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod, object[] testMethodArguments = null) | ||
| 19 | : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) | ||
| 20 | { | ||
| 21 | } | ||
| 22 | |||
| 23 | public override async Task<RunSummary> RunAsync(IMessageSink diagnosticMessageSink, | ||
| 24 | IMessageBus messageBus, | ||
| 25 | object[] constructorArguments, | ||
| 26 | ExceptionAggregator aggregator, | ||
| 27 | CancellationTokenSource cancellationTokenSource) | ||
| 28 | { | ||
| 29 | var skipMessageBus = new SkippableFactMessageBus(messageBus); | ||
| 30 | var result = await base.RunAsync(diagnosticMessageSink, skipMessageBus, constructorArguments, aggregator, cancellationTokenSource); | ||
| 31 | if (skipMessageBus.DynamicallySkippedTestCount > 0) | ||
| 32 | { | ||
| 33 | result.Failed -= skipMessageBus.DynamicallySkippedTestCount; | ||
| 34 | result.Skipped += skipMessageBus.DynamicallySkippedTestCount; | ||
| 35 | } | ||
| 36 | |||
| 37 | return result; | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } | ||
