diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-13 11:40:45 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-13 12:35:15 -0500 |
| commit | 031991f32f059b64374e6d257cbe573304dd577f (patch) | |
| tree | 9d11ebb5d8595bf45c507f38d637b14915af7630 /src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableTheoryTestCase.cs | |
| parent | ad6d2636f60b04ee68656f99fb3bd56a86ba5983 (diff) | |
| download | wix-031991f32f059b64374e6d257cbe573304dd577f.tar.gz wix-031991f32f059b64374e6d257cbe573304dd577f.tar.bz2 wix-031991f32f059b64374e6d257cbe573304dd577f.zip | |
Add ability to skip tests at runtime, and skip long running cache tests
6665
Diffstat (limited to 'src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableTheoryTestCase.cs')
| -rw-r--r-- | src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableTheoryTestCase.cs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableTheoryTestCase.cs b/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableTheoryTestCase.cs new file mode 100644 index 00000000..3299fe7e --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableTheoryTestCase.cs | |||
| @@ -0,0 +1,41 @@ | |||
| 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 SkippableTheoryTestCase : XunitTheoryTestCase | ||
| 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 SkippableTheoryTestCase() { } | ||
| 17 | |||
| 18 | public SkippableTheoryTestCase(IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod) | ||
| 19 | : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod) | ||
| 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 | // Duplicated code from SkippableFactTestCase. I'm sure we could find a way to de-dup with some thought. | ||
| 30 | var skipMessageBus = new SkippableFactMessageBus(messageBus); | ||
| 31 | var result = await base.RunAsync(diagnosticMessageSink, skipMessageBus, constructorArguments, aggregator, cancellationTokenSource); | ||
| 32 | if (skipMessageBus.DynamicallySkippedTestCount > 0) | ||
| 33 | { | ||
| 34 | result.Failed -= skipMessageBus.DynamicallySkippedTestCount; | ||
| 35 | result.Skipped += skipMessageBus.DynamicallySkippedTestCount; | ||
| 36 | } | ||
| 37 | |||
| 38 | return result; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | } | ||
