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/SkippableFactMessageBus.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 '')
| -rw-r--r-- | src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactMessageBus.cs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactMessageBus.cs b/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactMessageBus.cs new file mode 100644 index 00000000..6d01889e --- /dev/null +++ b/src/internal/WixBuildTools.TestSupport/XunitExtensions/SkippableFactMessageBus.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.Linq; | ||
| 6 | using Xunit.Abstractions; | ||
| 7 | using Xunit.Sdk; | ||
| 8 | |||
| 9 | public class SkippableFactMessageBus : IMessageBus | ||
| 10 | { | ||
| 11 | private IMessageBus InnerBus { get; } | ||
| 12 | |||
| 13 | public SkippableFactMessageBus(IMessageBus innerBus) | ||
| 14 | { | ||
| 15 | this.InnerBus = innerBus; | ||
| 16 | } | ||
| 17 | |||
| 18 | public int DynamicallySkippedTestCount { get; private set; } | ||
| 19 | |||
| 20 | public void Dispose() | ||
| 21 | { | ||
| 22 | } | ||
| 23 | |||
| 24 | public bool QueueMessage(IMessageSinkMessage message) | ||
| 25 | { | ||
| 26 | if (message is ITestFailed testFailed) | ||
| 27 | { | ||
| 28 | var exceptionType = testFailed.ExceptionTypes.FirstOrDefault(); | ||
| 29 | if (exceptionType == typeof(SkipTestException).FullName) | ||
| 30 | { | ||
| 31 | ++this.DynamicallySkippedTestCount; | ||
| 32 | return this.InnerBus.QueueMessage(new TestSkipped(testFailed.Test, testFailed.Messages.FirstOrDefault())); | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | // Nothing we care about, send it on its way | ||
| 37 | return this.InnerBus.QueueMessage(message); | ||
| 38 | } | ||
| 39 | } | ||
| 40 | } | ||
