diff --git a/Directory.Packages.props b/Directory.Packages.props
index af3d129d..3432a30d 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -15,7 +15,6 @@
-
@@ -27,15 +26,18 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/docfx/docs/toc.yml b/docfx/docs/toc.yml
index e7e565e2..e4ecdda3 100644
--- a/docfx/docs/toc.yml
+++ b/docfx/docs/toc.yml
@@ -1,3 +1,4 @@
+items:
- name: Features
href: features.md
- name: Getting Started
diff --git a/docfx/toc.yml b/docfx/toc.yml
index bcc98b4b..d88f5bda 100644
--- a/docfx/toc.yml
+++ b/docfx/toc.yml
@@ -1,3 +1,4 @@
+items:
- name: Docs
href: docs/
- name: API
diff --git a/global.json b/global.json
index 088f23e1..f3e0b323 100644
--- a/global.json
+++ b/global.json
@@ -1,6 +1,6 @@
{
"sdk": {
- "version": "9.0.100",
+ "version": "9.0.101",
"rollForward": "patch",
"allowPrerelease": false
}
diff --git a/test/.editorconfig b/test/.editorconfig
index 4219bf2d..1c5cc9c1 100644
--- a/test/.editorconfig
+++ b/test/.editorconfig
@@ -59,3 +59,6 @@ dotnet_diagnostic.VSTHRD003.severity = silent
# SA1611: Element parameters should be documented
dotnet_diagnostic.SA1611.severity = silent
+
+# xUnit1051: Calls to methods which accept CancellationToken should use TestContext.Current.CancellationToken
+dotnet_diagnostic.xUnit1051.severity = suggestion
diff --git a/test/IsolatedTestHost/IsolatedTestHost.csproj b/test/IsolatedTestHost/IsolatedTestHost.csproj
index 997e0e3b..535491f2 100644
--- a/test/IsolatedTestHost/IsolatedTestHost.csproj
+++ b/test/IsolatedTestHost/IsolatedTestHost.csproj
@@ -6,8 +6,7 @@
-
-
+
diff --git a/test/IsolatedTestHost/TestOutputHelper.cs b/test/IsolatedTestHost/TestOutputHelper.cs
index eb0e5904..a6323373 100644
--- a/test/IsolatedTestHost/TestOutputHelper.cs
+++ b/test/IsolatedTestHost/TestOutputHelper.cs
@@ -4,10 +4,22 @@
namespace IsolatedTestHost
{
using System;
- using Xunit.Abstractions;
+ using Xunit;
internal class TestOutputHelper : ITestOutputHelper
{
+ public string Output => throw new NotImplementedException();
+
+ public void Write(string message)
+ {
+ Console.Write(message);
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ Console.Write(format, args);
+ }
+
public void WriteLine(string message)
{
Console.WriteLine(message);
diff --git a/test/Nerdbank.Streams.Tests/BufferTextWriterTests.cs b/test/Nerdbank.Streams.Tests/BufferTextWriterTests.cs
index be6d6fb5..c566d9ab 100644
--- a/test/Nerdbank.Streams.Tests/BufferTextWriterTests.cs
+++ b/test/Nerdbank.Streams.Tests/BufferTextWriterTests.cs
@@ -9,7 +9,6 @@
using System.Threading.Tasks;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class BufferTextWriterTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/BufferWriterStreamTests.cs b/test/Nerdbank.Streams.Tests/BufferWriterStreamTests.cs
index 44a9c03d..02be4191 100644
--- a/test/Nerdbank.Streams.Tests/BufferWriterStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/BufferWriterStreamTests.cs
@@ -11,7 +11,6 @@
using Microsoft;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class BufferWriterStreamTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/FullDuplexStreamCombineTests.cs b/test/Nerdbank.Streams.Tests/FullDuplexStreamCombineTests.cs
index 850171c8..ef04742b 100644
--- a/test/Nerdbank.Streams.Tests/FullDuplexStreamCombineTests.cs
+++ b/test/Nerdbank.Streams.Tests/FullDuplexStreamCombineTests.cs
@@ -8,7 +8,6 @@
using NSubstitute;
using NSubstitute.ReceivedExtensions;
using Xunit;
-using Xunit.Abstractions;
public class FullDuplexStreamCombineTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/FullDuplexStreamPairTests.cs b/test/Nerdbank.Streams.Tests/FullDuplexStreamPairTests.cs
index 03e24e6b..ed56b26c 100644
--- a/test/Nerdbank.Streams.Tests/FullDuplexStreamPairTests.cs
+++ b/test/Nerdbank.Streams.Tests/FullDuplexStreamPairTests.cs
@@ -9,7 +9,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class FullDuplexStreamPairTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/HalfDuplexStreamTests.cs b/test/Nerdbank.Streams.Tests/HalfDuplexStreamTests.cs
index bed292d8..27dbb554 100644
--- a/test/Nerdbank.Streams.Tests/HalfDuplexStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/HalfDuplexStreamTests.cs
@@ -11,7 +11,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
#pragma warning disable CS0618 // Type or member is obsolete
diff --git a/test/Nerdbank.Streams.Tests/IOPipelinesStreamPipeReaderTests.cs b/test/Nerdbank.Streams.Tests/IOPipelinesStreamPipeReaderTests.cs
index 9a4de82d..8ad7beee 100644
--- a/test/Nerdbank.Streams.Tests/IOPipelinesStreamPipeReaderTests.cs
+++ b/test/Nerdbank.Streams.Tests/IOPipelinesStreamPipeReaderTests.cs
@@ -1,9 +1,8 @@
// Copyright (c) Andrew Arnott. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-using System.IO;
using System.IO.Pipelines;
-using Xunit.Abstractions;
+using Xunit;
public class IOPipelinesStreamPipeReaderTests : StreamPipeReaderTestBase
{
diff --git a/test/Nerdbank.Streams.Tests/MonitoringStreamTests.cs b/test/Nerdbank.Streams.Tests/MonitoringStreamTests.cs
index 8a3091ee..2b65826e 100644
--- a/test/Nerdbank.Streams.Tests/MonitoringStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/MonitoringStreamTests.cs
@@ -6,7 +6,6 @@
using Nerdbank.Streams;
using NSubstitute;
using Xunit;
-using Xunit.Abstractions;
public class MonitoringStreamTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingProtocolExceptionTests.cs b/test/Nerdbank.Streams.Tests/MultiplexingProtocolExceptionTests.cs
index b2eb876a..96f2cb60 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingProtocolExceptionTests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingProtocolExceptionTests.cs
@@ -4,7 +4,6 @@
using System;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class MultiplexingProtocolExceptionTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingStreamBasicTests.cs b/test/Nerdbank.Streams.Tests/MultiplexingStreamBasicTests.cs
index b9d01ce9..b5bed904 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingStreamBasicTests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingStreamBasicTests.cs
@@ -5,7 +5,6 @@
using Nerdbank.Streams;
using NSubstitute;
using Xunit;
-using Xunit.Abstractions;
public class MultiplexingStreamBasicTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingStreamChannelOptionsTests.cs b/test/Nerdbank.Streams.Tests/MultiplexingStreamChannelOptionsTests.cs
index 119eedd5..510ac286 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingStreamChannelOptionsTests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingStreamChannelOptionsTests.cs
@@ -6,7 +6,6 @@
using System.IO.Pipelines;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class MultiplexingStreamChannelOptionsTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingStreamPerfTests.cs b/test/Nerdbank.Streams.Tests/MultiplexingStreamPerfTests.cs
index e3822575..5ffc60a8 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingStreamPerfTests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingStreamPerfTests.cs
@@ -14,7 +14,6 @@
using Nerdbank.Streams;
using StreamJsonRpc;
using Xunit;
-using Xunit.Abstractions;
public class MultiplexingStreamPerfTests : TestBase, IAsyncLifetime
{
@@ -32,27 +31,28 @@ public MultiplexingStreamPerfTests(ITestOutputHelper logger)
this.clientPipe = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.Asynchronous);
}
- public async Task InitializeAsync()
+ public async ValueTask InitializeAsync()
{
Task connectTask = this.serverPipe.WaitForConnectionAsync(this.TimeoutToken);
await this.clientPipe.ConnectAsync(this.TimeoutToken);
await connectTask;
}
- public Task DisposeAsync()
+ public ValueTask DisposeAsync()
{
this.serverPipe.Dispose();
this.clientPipe.Dispose();
- return Task.CompletedTask;
+ this.Dispose();
+ return default;
}
- [SkippableFact]
+ [Fact]
public Task JsonRpcPerf_Pipe() => this.JsonRpcPerf(useChannel: false);
- [SkippableFact]
+ [Fact]
public Task JsonRpcPerf_Channel() => this.JsonRpcPerf(useChannel: true);
- [SkippableFact]
+ [Fact]
public async Task SendLargePayloadOnOneStream()
{
if (await this.ExecuteInIsolationAsync())
@@ -103,7 +103,7 @@ await Task.WhenAll(
}
}
- [SkippableFact]
+ [Fact]
public async Task SendLargePayloadOnManyChannels()
{
if (await this.ExecuteInIsolationAsync())
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingStreamSeededChannelTests.cs b/test/Nerdbank.Streams.Tests/MultiplexingStreamSeededChannelTests.cs
index bb6ed3f2..99461aa0 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingStreamSeededChannelTests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingStreamSeededChannelTests.cs
@@ -15,7 +15,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class MultiplexingStreamSeededChannelTests : TestBase, IAsyncLifetime
{
@@ -61,12 +60,12 @@ public MultiplexingStreamSeededChannelTests(ITestOutputHelper logger)
this.mx2 = MultiplexingStream.Create(this.transport2, new MultiplexingStream.Options(this.options) { TraceSource = mx2TraceSource, DefaultChannelTraceSourceFactoryWithQualifier = mx2TraceSourceFactory });
}
- public Task InitializeAsync()
+ public ValueTask InitializeAsync()
{
- return Task.CompletedTask;
+ return default;
}
- public async Task DisposeAsync()
+ public async ValueTask DisposeAsync()
{
await (this.mx1?.DisposeAsync() ?? default);
await (this.mx2?.DisposeAsync() ?? default);
@@ -75,6 +74,8 @@ public async Task DisposeAsync()
this.mx1?.TraceSource.Listeners.OfType().SingleOrDefault()?.Dispose();
this.mx2?.TraceSource.Listeners.OfType().SingleOrDefault()?.Dispose();
+
+ this.Dispose();
}
[Fact]
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingStreamTests.cs b/test/Nerdbank.Streams.Tests/MultiplexingStreamTests.cs
index e8b645a5..e84b0eca 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingStreamTests.cs
@@ -15,7 +15,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
#pragma warning disable SA1401 // Fields should be private
#pragma warning disable SA1414 // Tuple types in signatures should have element names
@@ -36,12 +35,12 @@ public MultiplexingStreamTests(ITestOutputHelper logger)
protected virtual int ProtocolMajorVersion { get; } = 1;
- public async Task InitializeAsync()
+ public async ValueTask InitializeAsync()
{
await this.ReinitializeMxStreamsAsync(new MultiplexingStream.Options());
}
- public async Task DisposeAsync()
+ public async ValueTask DisposeAsync()
{
await (this.mx1?.DisposeAsync() ?? default);
await (this.mx2?.DisposeAsync() ?? default);
@@ -50,6 +49,8 @@ public async Task DisposeAsync()
this.mx1?.TraceSource.Listeners.OfType().SingleOrDefault()?.Dispose();
this.mx2?.TraceSource.Listeners.OfType().SingleOrDefault()?.Dispose();
+
+ this.Dispose();
}
[Fact, Obsolete]
@@ -751,7 +752,7 @@ public async Task PartialFrameSentWithoutExplicitFlush()
await ReadAtLeastAsync(s2, new ArraySegment(recvBuffer), recvBuffer.Length, this.TimeoutToken);
}
- [SkippableTheory]
+ [Theory]
[InlineData(true)]
[InlineData(false)]
public async Task CancelChannelOfferBeforeAcceptance(bool cancelFirst)
@@ -771,20 +772,20 @@ public async Task CancelChannelOfferBeforeAcceptance(bool cancelFirst)
await Task.Delay(250);
}
- MultiplexingStream.Channel? acceptedChannel = await this.mx2.AcceptChannelAsync(string.Empty, ExpectedTimeoutToken).ConfigureAwait(false);
+ MultiplexingStream.Channel? acceptedChannel = await this.mx2.AcceptChannelAsync(string.Empty, ExpectedTimeoutToken);
acceptedStream = acceptedChannel.AsStream();
// In this case, we accepted the channel before receiving the cancellation notice. The channel should be terminated by the remote side very soon.
int bytesRead = await acceptedStream.ReadAsync(new byte[1], 0, 1, this.TimeoutToken).WithCancellation(this.TimeoutToken);
Assert.Equal(0, bytesRead); // confirm that the stream was closed.
this.Logger.WriteLine("Verified the channel terminated condition.");
- Skip.If(cancelFirst);
+ Assert.SkipWhen(cancelFirst, "Skipped");
}
catch (OperationCanceledException) when (acceptedStream == null)
{
// In this case, the channel offer was canceled before we accepted it.
this.Logger.WriteLine("Verified the channel offer was canceled before acceptance condition.");
- Skip.IfNot(cancelFirst);
+ Assert.SkipUnless(cancelFirst, "Skipped");
}
}
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingStreamV2Tests.cs b/test/Nerdbank.Streams.Tests/MultiplexingStreamV2Tests.cs
index a0fd8bb9..d0e6ece1 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingStreamV2Tests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingStreamV2Tests.cs
@@ -8,7 +8,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class MultiplexingStreamV2Tests : MultiplexingStreamTests
{
diff --git a/test/Nerdbank.Streams.Tests/MultiplexingStreamV3Tests.cs b/test/Nerdbank.Streams.Tests/MultiplexingStreamV3Tests.cs
index 660b7e51..8d336abb 100644
--- a/test/Nerdbank.Streams.Tests/MultiplexingStreamV3Tests.cs
+++ b/test/Nerdbank.Streams.Tests/MultiplexingStreamV3Tests.cs
@@ -6,7 +6,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class MultiplexingStreamV3Tests : MultiplexingStreamV2Tests
{
diff --git a/test/Nerdbank.Streams.Tests/Nerdbank.Streams.Tests.csproj b/test/Nerdbank.Streams.Tests/Nerdbank.Streams.Tests.csproj
index 9f5a5ba6..d6a2b9b1 100644
--- a/test/Nerdbank.Streams.Tests/Nerdbank.Streams.Tests.csproj
+++ b/test/Nerdbank.Streams.Tests/Nerdbank.Streams.Tests.csproj
@@ -2,6 +2,7 @@
net8.0
$(TargetFrameworks);net472
+ Exe
true
@@ -32,11 +33,9 @@
-
+
-
-
diff --git a/test/Nerdbank.Streams.Tests/NestedPipeReaderTests.cs b/test/Nerdbank.Streams.Tests/NestedPipeReaderTests.cs
index da6dbcf7..5f61aec7 100644
--- a/test/Nerdbank.Streams.Tests/NestedPipeReaderTests.cs
+++ b/test/Nerdbank.Streams.Tests/NestedPipeReaderTests.cs
@@ -8,7 +8,6 @@
using System.Threading.Tasks;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class NestedPipeReaderTests : TestBase, IAsyncLifetime
{
@@ -20,9 +19,13 @@ public NestedPipeReaderTests(ITestOutputHelper logger)
{
}
- public Task DisposeAsync() => Task.CompletedTask;
+ public ValueTask DisposeAsync()
+ {
+ this.Dispose();
+ return default;
+ }
- public async Task InitializeAsync()
+ public async ValueTask InitializeAsync()
{
await this.pipe.Writer.WriteAsync(OriginalBuffer, this.TimeoutToken);
}
diff --git a/test/Nerdbank.Streams.Tests/NestedStreamTests.cs b/test/Nerdbank.Streams.Tests/NestedStreamTests.cs
index 39c9de08..82c342f0 100644
--- a/test/Nerdbank.Streams.Tests/NestedStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/NestedStreamTests.cs
@@ -7,7 +7,6 @@
using Nerdbank.Streams;
using NSubstitute;
using Xunit;
-using Xunit.Abstractions;
public class NestedStreamTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/PipeExtensionsTests.cs b/test/Nerdbank.Streams.Tests/PipeExtensionsTests.cs
index 8e19635a..572a126d 100644
--- a/test/Nerdbank.Streams.Tests/PipeExtensionsTests.cs
+++ b/test/Nerdbank.Streams.Tests/PipeExtensionsTests.cs
@@ -9,7 +9,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
using IPC = System.IO.Pipes;
public partial class PipeExtensionsTests : TestBase
diff --git a/test/Nerdbank.Streams.Tests/PipeReaderCompletionWatcherTests.cs b/test/Nerdbank.Streams.Tests/PipeReaderCompletionWatcherTests.cs
index df34cbbf..b3375d26 100644
--- a/test/Nerdbank.Streams.Tests/PipeReaderCompletionWatcherTests.cs
+++ b/test/Nerdbank.Streams.Tests/PipeReaderCompletionWatcherTests.cs
@@ -6,7 +6,6 @@
using System.Threading.Tasks;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class PipeReaderCompletionWatcherTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/PipeStreamTests.cs b/test/Nerdbank.Streams.Tests/PipeStreamTests.cs
index 4476fbd0..ce35959b 100644
--- a/test/Nerdbank.Streams.Tests/PipeStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/PipeStreamTests.cs
@@ -16,7 +16,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class PipeStreamTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/PipeWriterCompletionWatcherTests.cs b/test/Nerdbank.Streams.Tests/PipeWriterCompletionWatcherTests.cs
index 6d43d6a2..eac979cc 100644
--- a/test/Nerdbank.Streams.Tests/PipeWriterCompletionWatcherTests.cs
+++ b/test/Nerdbank.Streams.Tests/PipeWriterCompletionWatcherTests.cs
@@ -6,7 +6,6 @@
using System.Threading.Tasks;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class PipeWriterCompletionWatcherTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/ReadOnlySequenceStreamTests.cs b/test/Nerdbank.Streams.Tests/ReadOnlySequenceStreamTests.cs
index 64879f60..981a1277 100644
--- a/test/Nerdbank.Streams.Tests/ReadOnlySequenceStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/ReadOnlySequenceStreamTests.cs
@@ -11,7 +11,6 @@
using Microsoft;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class ReadOnlySequenceStreamTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/SequenceTests.cs b/test/Nerdbank.Streams.Tests/SequenceTests.cs
index edac250d..79282189 100644
--- a/test/Nerdbank.Streams.Tests/SequenceTests.cs
+++ b/test/Nerdbank.Streams.Tests/SequenceTests.cs
@@ -10,7 +10,6 @@
using Microsoft;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class SequenceTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/SequenceTextReaderTests.cs b/test/Nerdbank.Streams.Tests/SequenceTextReaderTests.cs
index 377ec8c7..220a7bb2 100644
--- a/test/Nerdbank.Streams.Tests/SequenceTextReaderTests.cs
+++ b/test/Nerdbank.Streams.Tests/SequenceTextReaderTests.cs
@@ -10,7 +10,6 @@
using System.Threading.Tasks;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class SequenceTextReaderTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/SimplexStreamTests.cs b/test/Nerdbank.Streams.Tests/SimplexStreamTests.cs
index 1212bf67..9601da06 100644
--- a/test/Nerdbank.Streams.Tests/SimplexStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/SimplexStreamTests.cs
@@ -11,7 +11,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class SimplexStreamTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/StreamExtensionsTests.cs b/test/Nerdbank.Streams.Tests/StreamExtensionsTests.cs
index 8c55dd3f..90536591 100644
--- a/test/Nerdbank.Streams.Tests/StreamExtensionsTests.cs
+++ b/test/Nerdbank.Streams.Tests/StreamExtensionsTests.cs
@@ -8,7 +8,6 @@
using System.Threading.Tasks;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public class StreamExtensionsTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/StreamPipeReaderTestBase.cs b/test/Nerdbank.Streams.Tests/StreamPipeReaderTestBase.cs
index cb16770a..b2c7fe19 100644
--- a/test/Nerdbank.Streams.Tests/StreamPipeReaderTestBase.cs
+++ b/test/Nerdbank.Streams.Tests/StreamPipeReaderTestBase.cs
@@ -6,7 +6,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
public abstract class StreamPipeReaderTestBase : TestBase
{
@@ -23,10 +22,10 @@ public void ThrowsOnNull()
Assert.Throws(() => this.CreatePipeReader((Stream)null!));
}
- [SkippableFact]
+ [Fact]
public async Task Stream()
{
- Skip.If(this is IOPipelinesStreamPipeReaderTests, "OnWriterCompleted isn't supported.");
+ Assert.SkipWhen(this is IOPipelinesStreamPipeReaderTests, "OnWriterCompleted isn't supported.");
byte[] expectedBuffer = this.GetRandomBuffer(2048);
var stream = new MemoryStream(expectedBuffer);
@@ -241,10 +240,10 @@ public void AdvanceTo_BeforeRead()
Assert.True(ex is InvalidCastException || ex is InvalidOperationException);
}
- [SkippableFact]
+ [Fact]
public async Task OnWriterCompleted()
{
- Skip.If(this is IOPipelinesStreamPipeReaderTests, "OnWriterCompleted isn't supported.");
+ Assert.SkipWhen(this is IOPipelinesStreamPipeReaderTests, "OnWriterCompleted isn't supported.");
byte[] expectedBuffer = this.GetRandomBuffer(50);
var stream = new MemoryStream(expectedBuffer);
PipeReader? reader = this.CreatePipeReader(stream, sizeHint: 50);
diff --git a/test/Nerdbank.Streams.Tests/StreamPipeWriterTestBase.cs b/test/Nerdbank.Streams.Tests/StreamPipeWriterTestBase.cs
index 379db8da..b2e2be8f 100644
--- a/test/Nerdbank.Streams.Tests/StreamPipeWriterTestBase.cs
+++ b/test/Nerdbank.Streams.Tests/StreamPipeWriterTestBase.cs
@@ -7,7 +7,6 @@
using NSubstitute;
using NSubstitute.ReceivedExtensions;
using Xunit;
-using Xunit.Abstractions;
public abstract class StreamPipeWriterTestBase : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/StreamUsePipeReaderTests.cs b/test/Nerdbank.Streams.Tests/StreamUsePipeReaderTests.cs
index c0153de3..63a1c4da 100644
--- a/test/Nerdbank.Streams.Tests/StreamUsePipeReaderTests.cs
+++ b/test/Nerdbank.Streams.Tests/StreamUsePipeReaderTests.cs
@@ -7,7 +7,6 @@
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using Xunit;
-using Xunit.Abstractions;
public class StreamUsePipeReaderTests : StreamPipeReaderTestBase
{
diff --git a/test/Nerdbank.Streams.Tests/StreamUsePipeWriterTests.cs b/test/Nerdbank.Streams.Tests/StreamUsePipeWriterTests.cs
index 98f2ce3d..036c16a0 100644
--- a/test/Nerdbank.Streams.Tests/StreamUsePipeWriterTests.cs
+++ b/test/Nerdbank.Streams.Tests/StreamUsePipeWriterTests.cs
@@ -7,7 +7,6 @@
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using Xunit;
-using Xunit.Abstractions;
public class StreamUsePipeWriterTests : StreamPipeWriterTestBase
{
diff --git a/test/Nerdbank.Streams.Tests/StreamUseStrictPipeReaderTests.cs b/test/Nerdbank.Streams.Tests/StreamUseStrictPipeReaderTests.cs
index d5790daf..c137c661 100644
--- a/test/Nerdbank.Streams.Tests/StreamUseStrictPipeReaderTests.cs
+++ b/test/Nerdbank.Streams.Tests/StreamUseStrictPipeReaderTests.cs
@@ -7,7 +7,6 @@
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using Xunit;
-using Xunit.Abstractions;
[Obsolete("Tests functionality that .NET now exposes directly through PipeReader.Create(Stream)")]
public class StreamUseStrictPipeReaderTests : StreamPipeReaderTestBase
diff --git a/test/Nerdbank.Streams.Tests/StreamUseStrictPipeWriterTests.cs b/test/Nerdbank.Streams.Tests/StreamUseStrictPipeWriterTests.cs
index c2541cac..0dc892a8 100644
--- a/test/Nerdbank.Streams.Tests/StreamUseStrictPipeWriterTests.cs
+++ b/test/Nerdbank.Streams.Tests/StreamUseStrictPipeWriterTests.cs
@@ -6,7 +6,6 @@
using NSubstitute;
using NSubstitute.ExceptionExtensions;
using Xunit;
-using Xunit.Abstractions;
[Obsolete("Tests functionality that .NET now exposes directly through PipeWriter.Create(Stream)")]
public class StreamUseStrictPipeWriterTests : StreamPipeWriterTestBase
diff --git a/test/Nerdbank.Streams.Tests/SubstreamTests.cs b/test/Nerdbank.Streams.Tests/SubstreamTests.cs
index 464142fc..cd69488e 100644
--- a/test/Nerdbank.Streams.Tests/SubstreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/SubstreamTests.cs
@@ -5,7 +5,6 @@
using Nerdbank.Streams;
using NSubstitute;
using Xunit;
-using Xunit.Abstractions;
public class SubstreamTests : TestBase
{
diff --git a/test/Nerdbank.Streams.Tests/TestBase.cs b/test/Nerdbank.Streams.Tests/TestBase.cs
index 0fc31f70..68a1b03c 100644
--- a/test/Nerdbank.Streams.Tests/TestBase.cs
+++ b/test/Nerdbank.Streams.Tests/TestBase.cs
@@ -1,22 +1,17 @@
// Copyright (c) Andrew Arnott. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-using System;
using System.Buffers;
using System.Diagnostics;
-using System.IO;
using System.IO.Pipelines;
-using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
-using System.Threading;
-using System.Threading.Tasks;
using Microsoft;
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
+using Xunit.Sdk;
public abstract class TestBase : IDisposable
{
@@ -71,6 +66,7 @@ protected TestBase(ITestOutputHelper logger)
public void Dispose()
{
+ this.timeoutLoggerRegistration.Dispose();
this.Dispose(true);
GC.SuppressFinalize(this);
}
@@ -207,7 +203,7 @@ internal Task ExecuteInIsolationAsync(string testClassName, string testMet
#if NETFRAMEWORK
if (IsMono)
{
- return Task.FromException(new SkipException("Test isolation is not yet supported on this mono."));
+ return Task.FromException(SkipException.ForSkip("Test isolation is not yet supported on this mono."));
}
const string testHostProcessName = "IsolatedTestHost.exe";
@@ -264,7 +260,7 @@ internal Task ExecuteInIsolationAsync(string testClassName, string testMet
switch (t.Result)
{
case IsolatedTestHost.ExitCodes.TestSkipped:
- throw new SkipException("Test skipped. See output of isolated task for details.");
+ throw SkipException.ForSkip("Test skipped. See output of isolated task for details.");
case IsolatedTestHost.ExitCodes.TestPassed:
default:
Assert.Equal(IsolatedTestHost.ExitCodes.TestPassed, t.Result);
@@ -275,7 +271,7 @@ internal Task ExecuteInIsolationAsync(string testClassName, string testMet
},
TaskScheduler.Default);
#else
- return Task.FromException(new SkipException("Test isolation is not yet supported on this platform."));
+ return Task.FromException(SkipException.ForSkip("Test isolation is not yet supported on this platform."));
#endif
}
@@ -476,6 +472,8 @@ internal FileLogger(string fileName, ITestOutputHelper forwardTo)
this.forwardTo = forwardTo;
}
+ public string Output => throw new NotImplementedException();
+
public void WriteLine(string message)
{
this.file.WriteLine(message);
@@ -491,5 +489,19 @@ public void WriteLine(string format, params object[] args)
}
public void Dispose() => this.file.Dispose();
+
+ public void Write(string message)
+ {
+ this.file.Write(message);
+ this.forwardTo.Write(message);
+ Debug.Write(message);
+ }
+
+ public void Write(string format, params object[] args)
+ {
+ this.file.Write(format, args);
+ this.forwardTo.Write(format, args);
+ Debug.Write(string.Format(format, args));
+ }
}
}
diff --git a/test/Nerdbank.Streams.Tests/WebSocketStreamTests.cs b/test/Nerdbank.Streams.Tests/WebSocketStreamTests.cs
index eef241f9..7de6c36e 100644
--- a/test/Nerdbank.Streams.Tests/WebSocketStreamTests.cs
+++ b/test/Nerdbank.Streams.Tests/WebSocketStreamTests.cs
@@ -19,7 +19,6 @@
using Microsoft.VisualStudio.Threading;
using Nerdbank.Streams;
using Xunit;
-using Xunit.Abstractions;
#pragma warning disable SA1414 // Tuple types in signatures should have element names
diff --git a/test/Nerdbank.Streams.Tests/XunitTraceListener.cs b/test/Nerdbank.Streams.Tests/XunitTraceListener.cs
index 6558b124..2215372c 100644
--- a/test/Nerdbank.Streams.Tests/XunitTraceListener.cs
+++ b/test/Nerdbank.Streams.Tests/XunitTraceListener.cs
@@ -5,7 +5,7 @@
using System.Buffers;
using System.Diagnostics;
using System.Text;
-using Xunit.Abstractions;
+using Xunit;
internal class XunitTraceListener : TraceListener
{