diff --git a/.gitignore b/.gitignore
index 3a3033b..eb196cb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -207,4 +207,5 @@ UpgradeLog*.htm
.dotnet/
# Tools
-tools/
\ No newline at end of file
+tools/
+src/.vs/
diff --git a/build.fsx b/build.fsx
index 80ef71c..a3f8aff 100644
--- a/build.fsx
+++ b/build.fsx
@@ -17,8 +17,12 @@ let output = __SOURCE_DIRECTORY__ @@ "build"
let outputTests = output @@ "TestResults"
let outputBinaries = output @@ "binaries"
let outputNuGet = output @@ "nuget"
-let outputBinariesNet45 = outputBinaries @@ "net45"
-let outputBinariesNetStandard = outputBinaries @@ "netstandard1.0"
+let outputBinariesNet45 = outputBinaries @@ "net452"
+let outputBinariesNetStandard = outputBinaries @@ "netstandard2.0"
+
+// Configuration values for tests
+let testNetFrameworkVersion = "net461"
+let testNetCoreVersion = "netcoreapp3.1"
Target "Clean" (fun _ ->
CleanDir output
@@ -61,17 +65,63 @@ Target "Build" (fun _ ->
Configuration = configuration })
)
-Target "RunTests" (fun _ ->
- let projects = !! "./src/**/Reactive.Streams.Example.Unicast.Tests.csproj"
- ++ "./src/**/Reactive.Streams.TCK.Tests.csproj"
+module internal ResultHandling =
+ let (|OK|Failure|) = function
+ | 0 -> OK
+ | x -> Failure x
+
+ let buildErrorMessage = function
+ | OK -> None
+ | Failure errorCode ->
+ Some (sprintf "xUnit2 reported an error (Error Code %d)" errorCode)
+
+ let failBuildWithMessage = function
+ | DontFailBuild -> traceError
+ | _ -> (fun m -> raise(FailedTestsException m))
+
+ let failBuildIfXUnitReportedError errorLevel =
+ buildErrorMessage
+ >> Option.iter (failBuildWithMessage errorLevel)
+
+Target "RunTests" (fun _ ->
+ let projects =
+ match (isWindows) with
+ | true -> !! "./src/**/*.Tests.*sproj"
+ | _ -> !! "./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
+
+ let runSingleProject project =
+ let arguments =
+ (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetFrameworkVersion outputTests)
+
+ let result = ExecProcess(fun info ->
+ info.FileName <- "dotnet"
+ info.WorkingDirectory <- (Directory.GetParent project).FullName
+ info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
+
+ ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
+ CreateDir outputTests
+ projects |> Seq.iter (runSingleProject)
+)
+
+Target "RunTestsNetCore" (fun _ ->
+ let projects =
+ match (isWindows) with
+ | true -> !! "./src/**/*.Tests.*sproj"
+ | _ -> !! "./src/**/*.Tests.*sproj" // if you need to filter specs for Linux vs. Windows, do it here
+
let runSingleProject project =
- DotNetCli.Test
- (fun p ->
- { p with
- Project = project
- Configuration = configuration })
+ let arguments =
+ (sprintf "test -c Release --no-build --logger:trx --logger:\"console;verbosity=normal\" --framework %s --results-directory \"%s\" -- -parallel none" testNetCoreVersion outputTests)
+ let result = ExecProcess(fun info ->
+ info.FileName <- "dotnet"
+ info.WorkingDirectory <- (Directory.GetParent project).FullName
+ info.Arguments <- arguments) (TimeSpan.FromMinutes 30.0)
+
+ ResultHandling.failBuildIfXUnitReportedError TestRunnerErrorLevel.Error result
+
+ CreateDir outputTests
projects |> Seq.iter (runSingleProject)
)
@@ -102,19 +152,28 @@ Target "CreateNuget" (fun _ ->
)
Target "PublishNuget" (fun _ ->
- let projects = !! "./build/nuget/*.nupkg" -- "./build/nuget/*.symbols.nupkg"
- let apiKey = getBuildParamOrDefault "nugetkey" ""
- let source = getBuildParamOrDefault "nugetpublishurl" ""
- let symbolSource = getBuildParamOrDefault "symbolspublishurl" ""
-
- let runSingleProject project =
- DotNetCli.RunCommand
- (fun p ->
- { p with
- TimeOut = TimeSpan.FromMinutes 10. })
- (sprintf "nuget push %s --api-key %s --source %s --symbol-source %s" project apiKey source symbolSource)
-
- projects |> Seq.iter (runSingleProject)
+ let rec publishPackage url apiKey trialsLeft packageFile =
+ tracefn "Pushing %s Attempts left: %d" (FullName packageFile) trialsLeft
+ try
+ DotNetCli.RunCommand
+ (fun p ->
+ { p with
+ TimeOut = TimeSpan.FromMinutes 10. })
+ (sprintf "nuget push %s --api-key %s --source %s" packageFile apiKey url)
+ with exn ->
+ if (trialsLeft > 0) then (publishPackage url apiKey (trialsLeft-1) packageFile)
+ else raise exn
+
+ let shouldPushNugetPackages = hasBuildParam "nugetkey"
+
+ if (shouldPushNugetPackages) then
+ printfn "Pushing nuget packages"
+ let projects = !! "./build/nuget/*.nupkg" -- "./build/nuget/*.symbols.nupkg"
+ for package in projects do
+ try
+ publishPackage (getBuildParamOrDefault "nugetpublishurl" "https://api.nuget.org/v3/index.json") (getBuildParam "nugetkey") 3 package
+ with exn ->
+ printfn "%s" exn.Message
)
//--------------------------------------------------------------------------------
@@ -127,10 +186,11 @@ Target "Help" <| fun _ ->
"/build [target]"
""
" Targets for building:"
- " * Build Builds"
- " * Nuget Create and optionally publish nugets packages"
- " * RunTests Runs tests"
- " * All Builds, run tests, creates and optionally publish nuget packages"
+ " * Build Builds"
+ " * Nuget Create and optionally publish nugets packages"
+ " * RunTests Runs .NET Framework tests"
+ " * RunTestsNetCore Runs .NET Core tests"
+ " * All Builds, run tests, creates and optionally publish nuget packages"
""
" Other Targets"
" * Help Display this help"
@@ -175,18 +235,20 @@ Target "All" DoNothing
Target "Nuget" DoNothing
// build dependencies
-"Clean" ==> "RestorePackages" ==> "Build" ==> "BuildRelease"
+"Clean" ==> "RestorePackages" ==> "Build"
+"Build" ==> "BuildRelease"
// tests dependencies
-"Clean" ==> "RestorePackages" ==> "Build" ==> "RunTests"
+"Build" ==> "RunTests"
+"Build" ==> "RunTestsNetCore"
// nuget dependencies
-"Clean" ==> "RestorePackages" ==> "Build" ==> "CreateNuget"
-"CreateNuget" ==> "PublishNuget"
-"PublishNuget" ==> "Nuget"
+"BuildRelease" ==> "CreateNuget" ==> "PublishNuget" ==> "Nuget"
// all
"BuildRelease" ==> "All"
"RunTests" ==> "All"
+"RunTestsNetCore" ==> "All"
+"CreateNuget" ==> "All"
RunTargetOrDefault "Help"
\ No newline at end of file
diff --git a/build.ps1 b/build.ps1
index 96be84d..9d5a54d 100644
--- a/build.ps1
+++ b/build.ps1
@@ -29,12 +29,11 @@ Param(
[string[]]$ScriptArgs
)
-$FakeVersion = "4.57.4"
-$NUnitVersion = "3.6.0"
-$DotNetChannel = "preview";
-$DotNetVersion = "1.0.0";
-$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1";
-$NugetVersion = "4.1.0";
+$FakeVersion = "4.63.0"
+$DotNetChannel = "LTS";
+$DotNetVersion = "3.1.105";
+$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1";
+$NugetVersion = "4.3.0";
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/v$NugetVersion/nuget.exe"
# Make sure tools folder exists
@@ -111,20 +110,6 @@ if (!(Test-Path $FakeExePath)) {
}
}
-###########################################################################
-# INSTALL NUnit3 Test Runner
-###########################################################################
-
-# Make sure NUnit3 Test Runner has been installed.
-$NUnitDllPath = Join-Path $ToolPath "NUnit.ConsoleRunner/tools/nunit3-console.exe"
-if (!(Test-Path $NUnitDllPath)) {
- Write-Host "Installing NUnit3 Runner..."
- Invoke-Expression "&`"$NugetPath`" install NUnit.ConsoleRunner -ExcludeVersion -Version $NUnitVersion -OutputDirectory `"$ToolPath`"" | Out-Null;
- if ($LASTEXITCODE -ne 0) {
- Throw "An error occured while restoring NUnit3 Test from NuGet."
- }
-}
-
###########################################################################
# RUN BUILD SCRIPT
###########################################################################
diff --git a/src/Reactive.Streams.sln b/src/Reactive.Streams.sln
index d7de107..0123e4a 100644
--- a/src/Reactive.Streams.sln
+++ b/src/Reactive.Streams.sln
@@ -1,9 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25123.0
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30204.135
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactive.Streams", "api\Reactive.Streams\Reactive.Streams.csproj", "{68FBB4DF-6D83-4CF1-8105-A1D41912852F}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reactive.Streams", "api\Reactive.Streams\Reactive.Streams.csproj", "{68FBB4DF-6D83-4CF1-8105-A1D41912852F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{97BE0CEB-2816-47E9-ABC3-78905582A882}"
ProjectSection(SolutionItems) = preProject
@@ -17,16 +17,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{D389959C
ProjectSection(SolutionItems) = preProject
..\build.cmd = ..\build.cmd
..\build.fsx = ..\build.fsx
+ ..\build.ps1 = ..\build.ps1
..\build.sh = ..\build.sh
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactive.Streams.TCK", "tck\Reactive.Streams.TCK\Reactive.Streams.TCK.csproj", "{7DBE1261-04EB-4DA7-9953-C8E8CCC49010}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reactive.Streams.TCK", "tck\Reactive.Streams.TCK\Reactive.Streams.TCK.csproj", "{7DBE1261-04EB-4DA7-9953-C8E8CCC49010}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactive.Streams.TCK.Tests", "tck\Reactive.Streams.TCK.Tests\Reactive.Streams.TCK.Tests.csproj", "{0F1C51EB-3554-487F-8CE4-75CAAD2887F8}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reactive.Streams.TCK.Tests", "tck\Reactive.Streams.TCK.Tests\Reactive.Streams.TCK.Tests.csproj", "{0F1C51EB-3554-487F-8CE4-75CAAD2887F8}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactive.Streams.Example.Unicast", "examples\Reactive.Streams.Example.Unicast\Reactive.Streams.Example.Unicast.csproj", "{01737D0D-ED40-499B-A706-12BE9847491B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reactive.Streams.Example.Unicast", "examples\Reactive.Streams.Example.Unicast\Reactive.Streams.Example.Unicast.csproj", "{01737D0D-ED40-499B-A706-12BE9847491B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Reactive.Streams.Example.Unicast.Tests", "examples\Reactive.Streams.Example.Unicast.Tests\Reactive.Streams.Example.Unicast.Tests.csproj", "{A69C5115-5E39-47ED-B8EF-83A342968999}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Reactive.Streams.Example.Unicast.Tests", "examples\Reactive.Streams.Example.Unicast.Tests\Reactive.Streams.Example.Unicast.Tests.csproj", "{A69C5115-5E39-47ED-B8EF-83A342968999}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "api", "api", "{47E4C672-A6E8-43FE-A03E-761BC4601F84}"
EndProject
@@ -71,4 +72,7 @@ Global
{01737D0D-ED40-499B-A706-12BE9847491B} = {6CCDDC32-BD9D-4767-BF9A-64275D330558}
{A69C5115-5E39-47ED-B8EF-83A342968999} = {6CCDDC32-BD9D-4767-BF9A-64275D330558}
EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {33BB0CD0-DB06-47D3-8BDE-FB0ECFA5ACC2}
+ EndGlobalSection
EndGlobal
diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj
index b5bc346..b2b2a7f 100644
--- a/src/api/Reactive.Streams/Reactive.Streams.csproj
+++ b/src/api/Reactive.Streams/Reactive.Streams.csproj
@@ -6,11 +6,10 @@
MIT-0
1.0.3
Reactive Streams
- netstandard1.0;net45
+ netstandard2.0
reactive;stream
https://github.com/reactive-streams/reactive-streams-dotnet
http://creativecommons.org/publicdomain/zero/1.0/
- 1.6.0
true
diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs
index a88dd5d..dbfd078 100644
--- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs
+++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs
@@ -3,16 +3,16 @@
***************************************************/
using System;
using System.Threading;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK;
using Reactive.Streams.TCK.Support;
namespace Reactive.Streams.Example.Unicast.Tests
{
- [TestFixture]
public class AsyncSubscriberTest : SubscriberBlackboxVerification
{
- public AsyncSubscriberTest() : base(new TestEnvironment())
+ public AsyncSubscriberTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
@@ -25,7 +25,7 @@ private sealed class Suscriber : AsyncSubscriber
protected override bool WhenNext(int? element) => true;
}
- [Test]
+ [SkippableFact]
public void TestAccumulation()
{
var i = new AtomicCounterLong(0);
@@ -33,7 +33,7 @@ public void TestAccumulation()
var subscriber = new AccSubscriber(i, latch);
new NumberIterablePublisher(0,10).Subscribe(subscriber);
latch.Wait(TimeSpan.FromMilliseconds(Environment.DefaultTimeoutMilliseconds*10));
- Assert.AreEqual(45, i.Current);
+ Assert.Equal(45, i.Current);
}
private sealed class AccSubscriber : AsyncSubscriber
diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs
index 5bcf2e0..a2d97a9 100644
--- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs
+++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs
@@ -4,21 +4,22 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK;
namespace Reactive.Streams.Example.Unicast.Tests
{
- [TestFixture]
public class IterablePublisherTest : PublisherVerification
{
- public IterablePublisherTest() : base(new TestEnvironment())
+ public IterablePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
public override IPublisher CreatePublisher(long elements)
{
- Assert.LessOrEqual(elements, MaxElementsFromPublisher);
+ Assert.True(elements <= MaxElementsFromPublisher);
+ //Assert.LessOrEqual(elements, MaxElementsFromPublisher);
return new NumberIterablePublisher(0, (int)elements);
}
diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/Reactive.Streams.Example.Unicast.Tests.csproj b/src/examples/Reactive.Streams.Example.Unicast.Tests/Reactive.Streams.Example.Unicast.Tests.csproj
index f9bf5fc..9b72130 100644
--- a/src/examples/Reactive.Streams.Example.Unicast.Tests/Reactive.Streams.Example.Unicast.Tests.csproj
+++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/Reactive.Streams.Example.Unicast.Tests.csproj
@@ -1,7 +1,7 @@
-
+
Reactive.Streams.Example.Unicast.Tests
- net45
+ net461;netcoreapp3.1
win7-x64
@@ -12,9 +12,14 @@
-
-
-
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs
index d28a2de..087bdfe 100644
--- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs
+++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs
@@ -1,34 +1,43 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK;
namespace Reactive.Streams.Example.Unicast.Tests
{
- [TestFixture]
public class SyncSubscriberTest : SubscriberBlackboxVerification
{
- public SyncSubscriberTest() : base(new TestEnvironment())
+ private readonly ITestOutputHelper _output;
+
+ public SyncSubscriberTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
+ _output = output;
}
public override int? CreateElement(int element) => element;
- public override ISubscriber CreateSubscriber() => new Subscriber();
+ public override ISubscriber CreateSubscriber() => new Subscriber(_output);
private sealed class Subscriber : SyncSubscriber
{
+ private readonly ITestOutputHelper _output;
private long _acc;
+ public Subscriber(ITestOutputHelper output)
+ {
+ _output = output;
+ }
+
protected override bool WhenNext(int? element)
{
_acc += element.Value;
return true;
}
- public override void OnComplete() => Console.WriteLine("Accumulated: " + _acc);
+ public override void OnComplete() => _output?.WriteLine("Accumulated: " + _acc);
}
}
}
diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs
index 0ebfdaa..23df0ba 100644
--- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs
+++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs
@@ -1,16 +1,16 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK;
namespace Reactive.Streams.Example.Unicast.Tests
{
- [TestFixture]
public class ValueTypeSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification
{
- public ValueTypeSyncSubscriberWhiteboxTest() : base(new TestEnvironment())
+ public ValueTypeSyncSubscriberWhiteboxTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
@@ -70,10 +70,9 @@ public override void OnComplete()
}
}
- [TestFixture]
public class NullableSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification
{
- public NullableSyncSubscriberWhiteboxTest() : base(new TestEnvironment())
+ public NullableSyncSubscriberWhiteboxTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs
index 2289e7a..e4da786 100644
--- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs
+++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs
@@ -4,15 +4,15 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK;
namespace Reactive.Streams.Example.Unicast.Tests
{
- [TestFixture]
public class UnboundedIntegerIncrementPublisherTest : PublisherVerification
{
- public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment())
+ public UnboundedIntegerIncrementPublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
diff --git a/src/examples/Reactive.Streams.Example.Unicast/Reactive.Streams.Example.Unicast.csproj b/src/examples/Reactive.Streams.Example.Unicast/Reactive.Streams.Example.Unicast.csproj
index 84be131..729d2de 100644
--- a/src/examples/Reactive.Streams.Example.Unicast/Reactive.Streams.Example.Unicast.csproj
+++ b/src/examples/Reactive.Streams.Example.Unicast/Reactive.Streams.Example.Unicast.csproj
@@ -2,7 +2,7 @@
Reactive.Streams.Example.Unicast
- netstandard1.4;net45
+ netstandard2.0
true
@@ -10,10 +10,6 @@
-
-
-
-
$(DefineConstants);RELEASE
diff --git a/src/tck/README.md b/src/tck/README.md
index 1fe2e66..77b95d0 100644
--- a/src/tck/README.md
+++ b/src/tck/README.md
@@ -44,7 +44,7 @@ Here is an example test method signature:
```C#
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.1
-[Test]
+[SkippableFact]
public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements()
{
// ...
@@ -54,7 +54,7 @@ public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfPr
#### Test types explained:
```C#
-[Test]
+[SkippableFact]
public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements()
```
@@ -63,7 +63,7 @@ The `Required_` means that this test case is a hard requirement, it covers a *MU
```C#
-[Test]
+[SkippableFact]
public void Optional_spec104_mustSignalOnErrorWhenFails()
```
@@ -71,7 +71,7 @@ public void Optional_spec104_mustSignalOnErrorWhenFails()
The `Optional_` means that this test case is an optional requirement, it covers a *MAY* or *SHOULD* Rule of the Specification.
```C#
-[Test]
+[SkippableFact]
public void Stochastic_spec103_mustSignalOnMethodsSequentially()
```
@@ -80,7 +80,7 @@ The `Stochastic_` means that the Rule is impossible or infeasible to determinist
usually this means that this test case can yield false positives ("be green") even if for some case, the given implementation may violate the tested behaviour.
```C#
-[Test]
+[SkippableFact]
public void Untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled()
```
diff --git a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs
index d083c42..68b7f92 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs
@@ -1,16 +1,16 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System.Linq;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.Example.Unicast;
namespace Reactive.Streams.TCK.Tests
{
- [TestFixture]
public class EmptyLazyPublisherTest : PublisherVerification
{
- public EmptyLazyPublisherTest() : base(new TestEnvironment())
+ public EmptyLazyPublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs
index c20fa18..d724f11 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs
@@ -6,7 +6,8 @@
using System.Linq;
using System.Reflection;
using System.Text;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
namespace Reactive.Streams.TCK.Tests
{
@@ -19,7 +20,7 @@ namespace Reactive.Streams.TCK.Tests
///
public class IdentityProcessorVerificationDelegationTest
{
- [Test]
+ [SkippableFact]
public void ShouldIncludeAllTestsFromPublisherVerification()
{
var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList();
@@ -28,7 +29,7 @@ public void ShouldIncludeAllTestsFromPublisherVerification()
typeof(PublisherVerification<>), publisherTests);
}
- [Test]
+ [SkippableFact]
public void ShouldIncludeAllTestsFromSubscriberVerification()
{
var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList();
@@ -45,7 +46,7 @@ private static void AssertSuiteDelegatedAllTests(Type delegatingFrom, IList delegate{targetClass.Name}.{targetTest}();");
Assert.True(TestsInclude(allTests, targetTest), message.ToString());
@@ -57,7 +58,9 @@ private static bool TestsInclude(IList processorTests, string targetTest
private static IEnumerable GetTestNames(Type type)
=> type.GetMethods()
- .Where(m => m.GetCustomAttribute() != null)
+ .Where(m =>
+ m.GetCustomAttribute() != null ||
+ m.GetCustomAttribute() != null)
.Select(m => m.Name);
}
}
diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs
index 8eb44f1..d53b911 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs
@@ -1,8 +1,9 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Tests.Support;
namespace Reactive.Streams.TCK.Tests
@@ -14,23 +15,29 @@ public class IdentityProcessorVerificationTest : TCKVerificationSupport
private static readonly long DefaultNoSignalsTimeoutMilliseconds =
TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds();
- [Test]
+ private readonly ITestOutputHelper _output;
+
+ public IdentityProcessorVerificationTest(ITestOutputHelper output)
+ {
+ _output = output;
+ }
+
+ [SkippableFact]
public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldBeIgnored()
{
RequireTestSkip(() =>
{
- new Spec104IgnoreVerification(NewTestEnvironment())
+ new Spec104IgnoreVerification(NewTestEnvironment(_output))
.Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError();
}, "The Publisher under test only supports 1 subscribers, while this test requires at least 2 to run");
}
- [TestFixture(Ignore = "Helper verification for single test")]
private sealed class Spec104WaitingVerification : IdentityProcessorVerification
{
///
/// We need this constructor for NUnit even if the fixture is ignored
///
- public Spec104WaitingVerification() : base(new TestEnvironment())
+ public Spec104WaitingVerification(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
@@ -101,23 +108,22 @@ public Spec104WaitingVerification(TestEnvironment environment, long publisherRef
public override IPublisher CreateFailedPublisher() => null;
}
- [Test]
+ [SkippableFact]
public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldFailWhileWaitingForOnError()
{
RequireTestFailure(() =>
{
- new Spec104WaitingVerification(NewTestEnvironment(), DefaultTimeoutMilliseconds)
+ new Spec104WaitingVerification(NewTestEnvironment(_output), DefaultTimeoutMilliseconds)
.Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError();
}, "Did not receive expected error on downstream within " + DefaultTimeoutMilliseconds);
}
- [TestFixture(Ignore = "Helper verification for single test")]
private sealed class Spec104IgnoreVerification : IdentityProcessorVerification
{
///
/// We need this constructor for NUnit even if the fixture is ignored
///
- public Spec104IgnoreVerification() : base(new TestEnvironment())
+ public Spec104IgnoreVerification(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
@@ -138,8 +144,8 @@ public Spec104IgnoreVerification(TestEnvironment environment) : base(environment
public override long MaxSupportedSubscribers { get; } = 1;
}
- private static TestEnvironment NewTestEnvironment()
- => new TestEnvironment(DefaultTimeoutMilliseconds, DefaultNoSignalsTimeoutMilliseconds);
+ private static TestEnvironment NewTestEnvironment(ITestOutputHelper output)
+ => new TestEnvironment(DefaultTimeoutMilliseconds, DefaultNoSignalsTimeoutMilliseconds, output);
// FAILING IMPLEMENTATIONS //
diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs
index 3f0f5bd..e9fa67f 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs
@@ -4,7 +4,8 @@
using System;
using System.Threading;
using System.Threading.Tasks;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
using Reactive.Streams.TCK.Tests.Support;
@@ -16,22 +17,29 @@ namespace Reactive.Streams.TCK.Tests
///
public class PublisherVerificationTest : TCKVerificationSupport
{
- [Test]
+ private readonly ITestOutputHelper _output;
+
+ public PublisherVerificationTest(ITestOutputHelper output)
+ {
+ _output = output;
+ }
+
+ [SkippableFact]
public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements_shouldFailBy_ExpectingOnError()
=> RequireTestFailure(() => NoopPublisherVerification().Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements(),
"produced no element after first");
- [Test]
+ [SkippableFact]
public void Required_spec102_maySignalLessThanRequestedAndTerminateSubscription_shouldFailBy_notReceivingAnyElement()
=> RequireTestFailure(() => NoopPublisherVerification().Required_spec102_maySignalLessThanRequestedAndTerminateSubscription(),
"Did not receive expected element");
- [Test]
+ [SkippableFact]
public void Required_spec102_maySignalLessThanRequestedAndTerminateSubscription_shouldFailBy_receivingTooManyElements()
=> RequireTestFailure(() => DemandIgnoringSynchronousPublisherVerification().Required_spec102_maySignalLessThanRequestedAndTerminateSubscription(),
"Expected end-of-stream but got element [3]");
- [Test]
+ [SkippableFact]
public void Stochastic_spec103_mustSignalOnMethodsSequentially_shouldFailBy_concurrentlyAccessingOnNext()
{
var verification = CustomPublisherVerification(new ConcurrentAccessPublisher());
@@ -97,7 +105,7 @@ public void Subscribe(ISubscriber subscriber)
}));
}
- [Test]
+ [SkippableFact]
public void Stochastic_spec103_mustSignalOnMethodsSequentially_shouldPass_forSynchronousPublisher()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber =>
@@ -115,7 +123,7 @@ public void Stochastic_spec103_mustSignalOnMethodsSequentially_shouldPass_forSyn
CustomPublisherVerification(publisher).Stochastic_spec103_mustSignalOnMethodsSequentially();
}
- [Test]
+ [SkippableFact]
public void Optional_spec104_mustSignalOnErrorWhenFails_shouldFail()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber =>
@@ -127,12 +135,12 @@ public void Optional_spec104_mustSignalOnErrorWhenFails_shouldFail()
"Publisher threw exception (It is not valid to throw here!) instead of signalling error via onError!");
}
- [Test]
+ [SkippableFact]
public void Optional_spec104_mustSignalOnErrorWhenFails_shouldBeSkippedWhenNoErrorPublisherGiven()
=> RequireTestSkip(() => NoopPublisherVerification().Optional_spec104_mustSignalOnErrorWhenFails(),
PublisherVerification.SkippingNoErrorPublisherAvailable);
- [Test]
+ [SkippableFact]
public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates_shouldFail()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber =>
@@ -153,16 +161,15 @@ public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates_shou
messagePart: "Expected end-of-stream but got element [3]");
}
- [Test]
+ [SkippableFact]
public void Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete_shouldNotAllowEagerOnComplete()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber => subscriber.OnComplete());
- var verification = new Spec105Verification(NewTestEnvironment(), publisher);
+ var verification = new Spec105Verification(new TestEnvironment(_output), publisher);
RequireTestFailure(() => verification.Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete(),
"Subscriber.OnComplete() called before Subscriber.OnSubscribe");
}
- [TestFixture(Ignore = "Helper for single test")]
private sealed class Spec105Verification : PublisherVerification
{
private readonly IPublisher _publisher;
@@ -170,7 +177,7 @@ private sealed class Spec105Verification : PublisherVerification
///
/// We need this constructor for NUnit even if the fixture is ignored
///
- public Spec105Verification() : base(NewTestEnvironment())
+ public Spec105Verification(TestEnvironment environment) : base(environment)
{
}
@@ -187,7 +194,7 @@ public Spec105Verification(TestEnvironment environment, IPublisher publishe
public override long MaxElementsFromPublisher { get; } = 0; // it is an "empty" Publisher
}
- [Test]
+ [SkippableFact]
public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled_shouldFailForNotCompletingPublisher()
{
var cancellation = new CancellationTokenSource();
@@ -205,7 +212,7 @@ public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSigna
}
}
- [Test]
+ [SkippableFact]
public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled_shouldFailForPublisherWhichCompletesButKeepsServingData()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber =>
@@ -231,7 +238,7 @@ public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSigna
"Unexpected element 0 received after stream completed");
}
- [Test]
+ [SkippableFact]
public void Required_spec109_subscribeThrowNPEOnNullSubscriber_shouldFailIfDoesntThrowNPE()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber => { });
@@ -240,7 +247,7 @@ public void Required_spec109_subscribeThrowNPEOnNullSubscriber_shouldFailIfDoesn
"Publisher did not throw a ArgumentNullException when given a null Subscribe in subscribe");
}
- [Test]
+ [SkippableFact]
public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe_actuallyPass()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber =>
@@ -252,7 +259,7 @@ public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwil
.Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe();
}
- [Test]
+ [SkippableFact]
public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber_mustFailIfOnCompleteHappensFirst()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber => subscriber.OnComplete());
@@ -261,7 +268,7 @@ public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber_mustFailIf
"OnSubscribe should be called prior to OnComplete always");
}
- [Test]
+ [SkippableFact]
public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber_mustFailIfOnNextHappensFirst()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber => subscriber.OnNext(1337));
@@ -270,7 +277,7 @@ public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber_mustFailIf
"OnSubscribe should be called prior to OnNext always");
}
- [Test]
+ [SkippableFact]
public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber_mustFailIfOnErrorHappensFirst()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber => subscriber.OnError(new TestException()));
@@ -279,7 +286,7 @@ public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber_mustFailIf
"OnSubscribe should be called prior to OnError always");
}
- [Test]
+ [SkippableFact]
public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe_shouldFail()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber => subscriber.OnSubscribe(new LamdaSubscription()));
@@ -288,25 +295,25 @@ public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwil
"Should have received OnError");
}
- [Test]
+ [SkippableFact]
public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe_beSkippedForNoGivenErrorPublisher()
{
RequireTestSkip(() => NoopPublisherVerification().Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe(),
PublisherVerification.SkippingNoErrorPublisherAvailable);
}
- [Test]
+ [SkippableFact]
public void Untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice_shouldFailBy_skippingSinceOptional()
{
RequireTestFailure(() => NoopPublisherVerification().Untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice(),
"Not verified by this TCK.");
}
- [Test]
+ [SkippableFact]
public void Optional_spec111_maySupportMultiSubscribe_shouldFailBy_actuallyPass()
=> NoopPublisherVerification().Optional_spec111_maySupportMultiSubscribe();
- [Test]
+ [SkippableFact]
public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront_shouldFailBy_expectingOnError()
{
var random = new Random();
@@ -323,12 +330,12 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen
"Expected elements to be signaled in the same sequence to 1st and 2nd subscribers");
}
- [Test]
+ [SkippableFact]
public void Required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe_shouldFailBy_reportingAsyncError()
=> RequireTestFailure(() => OnErroringPublisherVerification().Required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe(),
"Async error during test execution: Test Exception: Boom!");
- [Test]
+ [SkippableFact]
public void Required_spec303_mustNotAllowUnboundedRecursion_shouldFailBy_informingAboutTooDeepStack()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber =>
@@ -343,16 +350,16 @@ public void Required_spec303_mustNotAllowUnboundedRecursion_shouldFailBy_informi
/*Got 2 onNext calls within thread: ... */ "yet expected recursive bound was 1");
}
- [Test]
+ [SkippableFact]
public void Required_spec306_afterSubscriptionIsCancelledRequestMustBeNops_shouldFailBy_unexpectedElement()
=> RequireTestFailure(() => DemandIgnoringSynchronousPublisherVerification().Required_spec306_afterSubscriptionIsCancelledRequestMustBeNops(),
"Did not expect an element but got element [0]");
- [Test]
+ [SkippableFact]
public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops_shouldPass()
=> DemandIgnoringSynchronousPublisherVerification().Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops();
- [Test]
+ [SkippableFact]
public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops_shouldFailBy_unexpectedErrorInCancelling()
{
var publisher = new LamdaPublisher(onSubscribe: subscriber =>
@@ -367,17 +374,17 @@ public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsM
"Async error during test execution: Test Exception: Boom!");
}
- [Test]
+ [SkippableFact]
public void Required_spec309_requestZeroMustSignalIllegalArgumentException_shouldFailBy_expectingOnError()
=> RequireTestFailure(() => NoopPublisherVerification().Required_spec309_requestZeroMustSignalIllegalArgumentException(),
"Expected OnError");
- [Test]
+ [SkippableFact]
public void Required_spec309_requestNegativeNumberMustSignalIllegalArgumentException_shouldFailBy_expectingOnError()
=> RequireTestFailure(() => NoopPublisherVerification().Required_spec309_requestNegativeNumberMustSignalIllegalArgumentException(),
"Expected OnError");
- [Test]
+ [SkippableFact]
public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling_shouldFailBy_havingEmitedMoreThanRequested()
{
var cancellation = new CancellationTokenSource();
@@ -395,7 +402,7 @@ public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling
}
}
- [Test]
+ [SkippableFact]
public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber_shouldFailBy_keepingTheReferenceLongerThanNeeded()
{
ISubscriber sub;
@@ -417,7 +424,7 @@ public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferenc
"did not drop reference to test subscriber after subscription cancellation");
}
- [Test]
+ [SkippableFact]
public void Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue_shouldFail_onAsynchDemandIgnoringPublisher()
{
var cancellation = new CancellationTokenSource();
@@ -435,12 +442,12 @@ public void Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue_sho
}
}
- [Test]
+ [SkippableFact]
public void Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue_shouldFail_onSynchDemandIgnoringPublisher()
=> RequireTestFailure(() => DemandIgnoringSynchronousPublisherVerification().Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue(),
"Received more than bufferSize (32) OnNext signals. The Publisher probably emited more signals than expected!");
- [Test]
+ [SkippableFact]
public void Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue_shouldFail_onSynchOverflowingPublisher()
{
var demand = 0L;
@@ -462,7 +469,7 @@ public void Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue_sh
"Async error during test execution: Illegally signalling OnError (violates rule 3.17)");
}
- [Test]
+ [SkippableFact]
public void Required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue_shouldFailWhenErrorSignalledOnceMaxValueReached()
{
var demand = 0L;
@@ -484,7 +491,7 @@ public void Required_spec317_mustSupportACumulativePendingElementCountUpToLongMa
"Async error during test execution: Illegally signalling onError too soon!");
}
- [Test]
+ [SkippableFact]
public void Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue_forSynchronousPublisher()
{
var sent = new AtomicCounter(0);
@@ -508,7 +515,7 @@ public void Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue_fo
verification.Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue();
// 11 due to the implementation of this particular TCK test (see impl)
- Assert.AreEqual(11, sent.Current);
+ Assert.Equal(11, sent.Current);
}
// FAILING IMPLEMENTATIONS //
@@ -524,7 +531,7 @@ private PublisherVerification NoopPublisherVerification()
subscriber.OnSubscribe(new LamdaSubscription());
});
- return new SimpleVerification(NewTestEnvironment(), publisher);
+ return new SimpleVerification(new TestEnvironment(_output), publisher);
}
///
@@ -540,21 +547,21 @@ private PublisherVerification OnErroringPublisherVerification()
}));
});
- return new SimpleVerification(NewTestEnvironment(), publisher);
+ return new SimpleVerification(new TestEnvironment(_output), publisher);
}
///
/// Custom Verification using given Publishers
///
private PublisherVerification CustomPublisherVerification(IPublisher publisher)
- => new SimpleVerification(new TestEnvironment(), publisher);
+ => new SimpleVerification(new TestEnvironment(_output), publisher);
///
/// Custom Verification using given Publishers
///
private PublisherVerification CustomPublisherVerification(IPublisher publisher,
IPublisher errorPublisher)
- => new SimpleVerification(new TestEnvironment(), publisher, errorPublisher);
+ => new SimpleVerification(new TestEnvironment(_output), publisher, errorPublisher);
///
/// Verification using a Publisher that publishes elements even with no demand available
@@ -570,7 +577,7 @@ private PublisherVerification DemandIgnoringSynchronousPublisherVerificatio
subscriber.OnNext((int)i);
}));
});
- return new SimpleVerification(new TestEnvironment(), publisher);
+ return new SimpleVerification(new TestEnvironment(_output), publisher);
}
///
@@ -586,7 +593,7 @@ private PublisherVerification DemandIgnoringAsynchronousPublisherVerificati
/// Verification using a Publisher that publishes elements even with no demand available, from multiple threads (!).
///
private PublisherVerification DemandIgnoringAsynchronousPublisherVerification(bool swallowOnNextExceptions, CancellationToken token)
- => new SimpleVerification(new TestEnvironment(), new DemandIgnoringAsyncPublisher(swallowOnNextExceptions, token));
+ => new SimpleVerification(new TestEnvironment(_output), new DemandIgnoringAsyncPublisher(swallowOnNextExceptions, token));
private sealed class DemandIgnoringAsyncPublisher : IPublisher
{
@@ -657,7 +664,6 @@ public void Subscribe(ISubscriber subscriber)
}));
}
- [TestFixture(Ignore = "Helper for single test")]
private sealed class SimpleVerification : PublisherVerification
{
private readonly IPublisher _publisher;
@@ -666,7 +672,7 @@ private sealed class SimpleVerification : PublisherVerification
///
/// We need this constructor for NUnit even if the fixture is ignored
///
- public SimpleVerification() : base(NewTestEnvironment()) { }
+ public SimpleVerification(TestEnvironment environment) : base(environment) { }
public SimpleVerification(TestEnvironment environment, IPublisher publisher, IPublisher failedPublisher = null) : base(environment)
{
@@ -679,6 +685,5 @@ public SimpleVerification(TestEnvironment environment, IPublisher publisher
public override IPublisher CreateFailedPublisher() => _failedPublisher;
}
- private static TestEnvironment NewTestEnvironment() => new TestEnvironment();
}
}
diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs
index 08b0508..cf5d416 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs
@@ -1,7 +1,8 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
-using NUnit.Framework;
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
+using Xunit;
+using Xunit.Abstractions;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -13,8 +14,8 @@
namespace Reactive.Streams.TCK.Tests
{
- [TestFixture]
- public class RangePublisherTest : PublisherVerification
+ //[TestFixture]
+ public class RangePublisherTest : PublisherVerification, IDisposable
{
static readonly ConcurrentDictionary stacks = new ConcurrentDictionary();
@@ -22,31 +23,7 @@ public class RangePublisherTest : PublisherVerification
static int id;
- [TearDown]
- public void AfterTest()
- {
- bool fail = false;
- StringBuilder b = new StringBuilder();
- foreach (var t in states)
- {
- if (!t.Value)
- {
- b.Append("\r\n-------------------------------");
-
- b.Append("\r\nat ").Append(stacks[t.Key]);
-
- fail = true;
- }
- }
- states.Clear();
- stacks.Clear();
- if (fail)
- {
- throw new InvalidOperationException("Cancellations were missing:" + b);
- }
- }
-
- public RangePublisherTest() : base(new TestEnvironment())
+ public RangePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
@@ -191,5 +168,28 @@ public void Cancel()
}
}
}
+
+ public void Dispose()
+ {
+ bool fail = false;
+ StringBuilder b = new StringBuilder();
+ foreach (var t in states)
+ {
+ if (!t.Value)
+ {
+ b.Append("\r\n-------------------------------");
+
+ b.Append("\r\nat ").Append(stacks[t.Key]);
+
+ fail = true;
+ }
+ }
+ states.Clear();
+ stacks.Clear();
+ if (fail)
+ {
+ throw new InvalidOperationException("Cancellations were missing:" + b);
+ }
+ }
}
}
diff --git a/src/tck/Reactive.Streams.TCK.Tests/Reactive.Streams.TCK.Tests.csproj b/src/tck/Reactive.Streams.TCK.Tests/Reactive.Streams.TCK.Tests.csproj
index 4444511..24fa3f5 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/Reactive.Streams.TCK.Tests.csproj
+++ b/src/tck/Reactive.Streams.TCK.Tests/Reactive.Streams.TCK.Tests.csproj
@@ -1,7 +1,7 @@
Reactive.Streams.TCK.Tests
- net45
+ net461;netcoreapp3.1
win7-x64
@@ -12,9 +12,14 @@
-
-
-
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs
index 28f6876..0862005 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs
@@ -1,16 +1,16 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System.Linq;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.Example.Unicast;
namespace Reactive.Streams.TCK.Tests
{
- [TestFixture]
public class SingleElementPublisherTest : PublisherVerification
{
- public SingleElementPublisherTest() : base(new TestEnvironment())
+ public SingleElementPublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs
index 589d21c..b777b4b 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs
@@ -1,8 +1,9 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Tests.Support;
namespace Reactive.Streams.TCK.Tests
@@ -11,20 +12,26 @@ namespace Reactive.Streams.TCK.Tests
/// Validates that the TCK's fails with nice human readable errors.
/// >Important: Please note that all Publishers implemented in this file are *wrong*!
///
- [TestFixture]
public class SubscriberBlackboxVerificationTest : TCKVerificationSupport
{
- [Test]
+ private readonly ITestOutputHelper _output;
+
+ public SubscriberBlackboxVerificationTest(ITestOutputHelper output)
+ {
+ _output = output;
+ }
+
+ [SkippableFact]
public void Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall()
=> RequireTestFailure(
() => NoopSubscriberVerification().Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest(),
"Did not receive expected `Request` call within");
- [Test]
+ [SkippableFact]
public void Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest_shouldPass()
=> SimpleSubscriberVerification().Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest();
- [Test]
+ [SkippableFact]
public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete_shouldFail_dueToCallingRequest()
{
ISubscription subscription = null;
@@ -35,7 +42,7 @@ public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublishe
"Subscription.Request MUST NOT be called from Subscriber.OnComplete (Rule 2.3)!");
}
- [Test]
+ [SkippableFact]
public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete_shouldFail_dueToCallingCancel()
{
ISubscription subscription = null;
@@ -46,7 +53,7 @@ public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublishe
"Subscription.Cancel MUST NOT be called from Subscriber.OnComplete (Rule 2.3)!");
}
- [Test]
+ [SkippableFact]
public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingRequest()
{
ISubscription subscription = null;
@@ -57,7 +64,7 @@ public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublishe
"Subscription.Request MUST NOT be called from Subscriber.OnError (Rule 2.3)!");
}
- [Test]
+ [SkippableFact]
public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingCancel()
{
ISubscription subscription = null;
@@ -68,7 +75,7 @@ public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublishe
"Subscription.Cancel MUST NOT be called from Subscriber.OnError (Rule 2.3)!");
}
- [Test]
+ [SkippableFact]
public void Required_spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal_shouldFail()
{
ISubscription subscription = null;
@@ -82,18 +89,18 @@ public void Required_spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAn
"illegally called `Subscription.Request(1)`");
}
- [Test]
+ [SkippableFact]
public void Required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall_shouldFail()
=> RequireTestFailure(
() => CustomSubscriberVerification(new LamdaSubscriber()).Required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall(),
"did not call `RegisterOnComplete()`");
- [Test]
+ [SkippableFact]
public void Required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall_shouldPass_withNoopSubscriber()
=> CustomSubscriberVerification(new LamdaSubscriber())
.Required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall();
- [Test]
+ [SkippableFact]
public void Required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall_shouldFail()
{
var subscriber = new LamdaSubscriber(onError: cause =>
@@ -106,25 +113,25 @@ public void Required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWith
"Test Exception: Boom!"); // checks that the expected exception was delivered to onError, we don't expect anyone to implement onError so weirdly
}
- [Test]
+ [SkippableFact]
public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParametersAreNull_mustFailOnIgnoredNull_onSubscribe()
=> RequireTestFailure(
() => CustomSubscriberVerification(new LamdaSubscriber()).Required_spec213_blackbox_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull(),
"OnSubscribe(null) did not throw ArgumentNullException");
- [Test]
+ [SkippableFact]
public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParametersAreNull_mustFailOnIgnoredNull_onNext()
=> RequireTestFailure(
() => CustomSubscriberVerification(new LamdaSubscriber()).Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenParametersAreNull(),
"OnNext(null) did not throw ArgumentNullException");
- [Test]
+ [SkippableFact]
public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParametersAreNull_mustIgnoreSpecForValueType_onNext()
=> RequireTestSkip(
() => SimpleSubscriberVerification().Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenParametersAreNull(),
"Can't verify behavior for value types");
- [Test]
+ [SkippableFact]
public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParametersAreNull_mustFailOnIgnoredNull_onError()
=> RequireTestFailure(
() => CustomSubscriberVerification(new LamdaSubscriber()).Required_spec213_blackbox_onError_mustThrowNullPointerExceptionWhenParametersAreNull(),
@@ -137,17 +144,10 @@ public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParameter
/// Verification using a Subscriber that doesn't do anything on any of the callbacks
///
private SubscriberBlackboxVerification NoopSubscriberVerification()
- => new NoopBlackboxVerification(new TestEnvironment());
+ => new NoopBlackboxVerification(new TestEnvironment(_output));
- [TestFixture(Ignore = "Helper verification for single test")]
private sealed class NoopBlackboxVerification : SubscriberBlackboxVerification
{
- //Requirement for NUnit even if the tests are ignored
- public NoopBlackboxVerification() : base(new TestEnvironment())
- {
-
- }
-
public NoopBlackboxVerification(TestEnvironment environment) : base(environment)
{
}
@@ -161,17 +161,10 @@ public NoopBlackboxVerification(TestEnvironment environment) : base(environment)
/// Verification using a Subscriber that only calls 'Requests(1)' on 'OnSubscribe' and 'OnNext'
///
private SubscriberBlackboxVerification SimpleSubscriberVerification()
- => new SimpleBlackboxVerification(new TestEnvironment());
+ => new SimpleBlackboxVerification(new TestEnvironment(_output));
- [TestFixture(Ignore = "Helper verification for single test")]
private sealed class SimpleBlackboxVerification : SubscriberBlackboxVerification
{
- //Requirement for NUnit even if the tests are ignored
- public SimpleBlackboxVerification() : base(new TestEnvironment())
- {
-
- }
-
public SimpleBlackboxVerification(TestEnvironment environment) : base(environment)
{
}
@@ -195,19 +188,12 @@ public override ISubscriber CreateSubscriber()
/// Custom Verification using given Subscriber
///
private SubscriberBlackboxVerification CustomSubscriberVerification(ISubscriber subscriber)
- => new CustomBlackboxVerification(new TestEnvironment(), subscriber);
+ => new CustomBlackboxVerification(new TestEnvironment(_output), subscriber);
- [TestFixture(Ignore = "Helper verification for single test")]
private sealed class CustomBlackboxVerification : SubscriberBlackboxVerification
{
private readonly ISubscriber _subscriber;
- //Requirement for NUnit even if the tests are ignored
- public CustomBlackboxVerification() : base(new TestEnvironment())
- {
-
- }
-
public CustomBlackboxVerification(TestEnvironment environment, ISubscriber subscriber) : base(environment)
{
_subscriber = subscriber;
diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs
index 1f9e132..e079c3c 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs
@@ -3,7 +3,8 @@
***************************************************/
using System;
using System.Runtime.CompilerServices;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
using Reactive.Streams.TCK.Tests.Support;
@@ -13,10 +14,16 @@ namespace Reactive.Streams.TCK.Tests
/// Validates that the TCK's fails with nice human readable errors.
/// >Important: Please note that all Publishers implemented in this file are *wrong*!
///
- [TestFixture]
public class SubscriberWhiteboxVerificationTest : TCKVerificationSupport
{
- [Test]
+ private readonly ITestOutputHelper _output;
+
+ public SubscriberWhiteboxVerificationTest(ITestOutputHelper output)
+ {
+ _output = output;
+ }
+
+ [SkippableFact]
public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall()
{
// this mostly verifies the probe is injected correctly
@@ -37,11 +44,11 @@ public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy
"Did not receive expected `Request` call within");
}
- [Test]
+ [SkippableFact]
public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldPass()
=> SimpleSubscriberVerification().Required_spec201_mustSignalDemandViaSubscriptionRequest();
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete_shouldFail_dueToCallingRequest()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -62,7 +69,7 @@ public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComp
"Subscription.Request MUST NOT be called from Subscriber.OnComplete (Rule 2.3)!");
}
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete_shouldFail_dueToCallingCancel()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -84,7 +91,7 @@ public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComp
}
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingRequest()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -104,7 +111,7 @@ public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnErro
"Subscription.Request MUST NOT be called from Subscriber.OnError (Rule 2.3)!");
}
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingCancel()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -124,7 +131,7 @@ public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnErro
"Subscription.Cancel MUST NOT be called from Subscriber.OnError (Rule 2.3)!");
}
- [Test]
+ [SkippableFact]
public void Required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal_shouldFail()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -140,7 +147,7 @@ public void Required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscript
"Expected 2nd Subscription given to subscriber to be cancelled");
}
- [Test]
+ [SkippableFact]
public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel_shouldFail()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -176,7 +183,7 @@ public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCall
"But I thought it's cancelled!");
}
- [Test]
+ [SkippableFact]
public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall_shouldFail()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -191,7 +198,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPreced
"did not call `RegisterOnComplete()`");
}
- [Test]
+ [SkippableFact]
public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall_shouldPass_withNoopSubscriber()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -206,7 +213,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPre
"did not call `RegisterOnSubscribe`");
}
- [Test]
+ [SkippableFact]
public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall_shouldFail()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -222,7 +229,7 @@ public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPreceding
"Test Exception: Boom!");
}
- [Test]
+ [SkippableFact]
public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall_shouldFail()
{
Func, ISubscriber> createSubscriber = probe =>
@@ -238,7 +245,7 @@ public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPreced
"Test Exception: Boom!");
}
- [Test]
+ [SkippableFact]
public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced_shouldFail()
{
// sanity checks the "happy path", that triggerRequest() propagates the right demand
@@ -257,19 +264,10 @@ public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced_
/// This verification can be used in the "simples case, subscriber which does basically nothing case" validation.
///
private SubscriberWhiteboxVerification SimpleSubscriberVerification()
- => new SimpleWhiteboxVerification(new TestEnvironment());
+ => new SimpleWhiteboxVerification(new TestEnvironment(_output));
- [TestFixture(Ignore = "Helper verification for single test")]
private sealed class SimpleWhiteboxVerification : SubscriberWhiteboxVerification
{
- ///
- /// We need this constructor for NUnit even if the fixture is ignored
- ///
- public SimpleWhiteboxVerification() : base(new TestEnvironment())
- {
-
- }
-
public SimpleWhiteboxVerification(TestEnvironment environment) : base(environment)
{
}
@@ -291,21 +289,12 @@ public SimpleWhiteboxVerification(TestEnvironment environment) : base(environmen
///
private SubscriberWhiteboxVerification CustomSubscriberVerification(
Func, ISubscriber> newSubscriber)
- => new CustomWhiteboxVerification(new TestEnvironment(), newSubscriber);
+ => new CustomWhiteboxVerification(new TestEnvironment(_output), newSubscriber);
- [TestFixture(Ignore = "Helper verification for single test")]
private sealed class CustomWhiteboxVerification : SubscriberWhiteboxVerification
{
private readonly Func, ISubscriber> _newSubscriber;
- ///
- /// We need this constructor for NUnit even if the fixture is ignored
- ///
- public CustomWhiteboxVerification() : base(new TestEnvironment())
- {
-
- }
-
public CustomWhiteboxVerification(TestEnvironment environment,
Func, ISubscriber> newSubscriber) : base(environment)
{
diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs
index 7420803..28986e0 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs
@@ -1,8 +1,9 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
namespace Reactive.Streams.TCK.Tests.Support
@@ -44,7 +45,7 @@ public void RequireTestFailure(Action throwingRun, string messagePart)
}
///
- /// Runs given code block and expects it fail with an
+ /// Runs given code block and expects it fail with an
///
/// encapsulates test case which we expect to be skipped
/// the exception failing the test (inside the run parameter) must contain this message part in one of it's causes
@@ -54,7 +55,7 @@ public void RequireTestSkip(Action throwingRun, string messagePart)
{
throwingRun();
}
- catch (IgnoreException ignore)
+ catch (SkipException ignore)
{
if(ignore.Message.Contains(messagePart))
return;
@@ -134,7 +135,7 @@ private bool FindDeepErrorMessage(Exception exception, string messagePart, int d
{
if (exception is NullReferenceException)
{
- Assert.Fail($"{typeof(NullReferenceException).Name} was thrown, definitely not a helpful error!",
+ TckAssert.Fail($"{nameof(NullReferenceException)} was thrown, definitely not a helpful error!",
exception);
}
if (exception == null || depth == 0)
diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs
index c4590ce..0e7dd7c 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs
@@ -1,15 +1,15 @@
-/***************************************************
+/***************************************************
* Licensed under MIT No Attribution (SPDX: MIT-0) *
***************************************************/
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Tests.Support;
namespace Reactive.Streams.TCK.Tests
{
- [TestFixture]
public class SyncTriggeredDemandSubscriberTest : SubscriberBlackboxVerification
{
- public SyncTriggeredDemandSubscriberTest() : base(new TestEnvironment())
+ public SyncTriggeredDemandSubscriberTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs
index f58c9c0..9b00c1c 100644
--- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs
+++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs
@@ -1,16 +1,16 @@
-/***************************************************
- * Licensed under MIT No Attribution (SPDX: MIT-0) *
- ***************************************************/
+/***************************************************
+* Licensed under MIT No Attribution (SPDX: MIT-0) *
+***************************************************/
using System;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Tests.Support;
namespace Reactive.Streams.TCK.Tests
{
- [TestFixture]
public class SyncTriggeredDemandSubscriberWhiteboxTest : SubscriberWhiteboxVerification
{
- public SyncTriggeredDemandSubscriberWhiteboxTest() : base(new TestEnvironment())
+ public SyncTriggeredDemandSubscriberWhiteboxTest(ITestOutputHelper output) : base(new TestEnvironment(output))
{
}
diff --git a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs
index 91bafd2..1cd0366 100644
--- a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs
+++ b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs
@@ -3,7 +3,8 @@
***************************************************/
using System;
using System.Collections.Generic;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
namespace Reactive.Streams.TCK
@@ -55,6 +56,8 @@ protected IdentityProcessorVerification(TestEnvironment environment, long publis
_processorBufferSize = processorBufferSize;
_subscriberVerification = new IdentifierWhiteboxVerification(this);
_publisherVerification = new IdentifierPublisherVerification(this, publisherReferenceGcTimeoutMillis);
+
+ SetUp();
}
private sealed class IdentifierPublisherVerification : PublisherVerification
@@ -157,7 +160,6 @@ public override ISubscriber CreateSubscriber(WhiteboxSubscriberProbe probe
////////////////////// TEST ENV CLEANUP /////////////////////////////////////
- [SetUp]
public void SetUp()
{
_publisherVerification.SetUp();
@@ -174,11 +176,11 @@ public IPublisher CreatePublisher(long elements)
return processor; // we run the PublisherVerification against this
}
- [Test]
+ [SkippableFact]
public void Required_validate_maxElementsFromPublisher()
=> _publisherVerification.Required_validate_maxElementsFromPublisher();
- [Test]
+ [SkippableFact]
public void Required_validate_boundedDepthOfOnNextAndRequestRecursion()
=> _publisherVerification.Required_validate_boundedDepthOfOnNextAndRequestRecursion();
@@ -186,146 +188,146 @@ public void Required_validate_boundedDepthOfOnNextAndRequestRecursion()
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#4.1
- [Test]
+ [SkippableFact]
public void Required_createPublisher1MustProduceAStreamOfExactly1Element()
=> _publisherVerification.Required_createPublisher1MustProduceAStreamOfExactly1Element();
- [Test]
+ [SkippableFact]
public void Required_createPublisher3MustProduceAStreamOfExactly3Elements()
=> _publisherVerification.Required_createPublisher3MustProduceAStreamOfExactly3Elements();
- [Test]
+ [SkippableFact]
public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements()
=> _publisherVerification.Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements();
- [Test]
+ [SkippableFact]
public void Required_spec102_maySignalLessThanRequestedAndTerminateSubscription()
=> _publisherVerification.Required_spec102_maySignalLessThanRequestedAndTerminateSubscription();
- [Test]
+ [SkippableFact]
public void Stochastic_spec103_mustSignalOnMethodsSequentially()
=> _publisherVerification.Stochastic_spec103_mustSignalOnMethodsSequentially();
- [Test]
+ [SkippableFact]
public void Optional_spec104_mustSignalOnErrorWhenFails()
=> _publisherVerification.Optional_spec104_mustSignalOnErrorWhenFails();
- [Test]
+ [SkippableFact]
public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates()
=> _publisherVerification.Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates();
- [Test]
+ [SkippableFact]
public void Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete()
=> _publisherVerification.Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete();
- [Test]
+ [SkippableFact]
public void Untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled()
=> _publisherVerification.Untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled();
- [Test]
+ [SkippableFact]
public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled()
=> _publisherVerification.Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled();
- [Test]
+ [SkippableFact]
public void Untested_spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled()
=> _publisherVerification.Untested_spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled();
- [Test]
+ [SkippableFact]
public void Untested_spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals()
=> _publisherVerification.Untested_spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals();
- [Test]
+ [SkippableFact]
public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber()
=> _publisherVerification.Required_spec109_mustIssueOnSubscribeForNonNullSubscriber();
- [Test]
+ [SkippableFact]
public void Untested_spec109_subscribeShouldNotThrowNonFatalThrowable()
=> _publisherVerification.Untested_spec109_subscribeShouldNotThrowNonFatalThrowable();
- [Test]
+ [SkippableFact]
public void Required_spec109_subscribeThrowNPEOnNullSubscriber()
=> _publisherVerification.Required_spec109_subscribeThrowNPEOnNullSubscriber();
- [Test]
+ [SkippableFact]
public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe()
=> _publisherVerification.Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe();
- [Test]
+ [SkippableFact]
public void Untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice()
=> _publisherVerification.Untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice();
- [Test]
+ [SkippableFact]
public void Optional_spec111_maySupportMultiSubscribe()
=> _publisherVerification.Optional_spec111_maySupportMultiSubscribe();
- [Test]
+ [SkippableFact]
public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne()
=> _publisherVerification.Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne();
- [Test]
+ [SkippableFact]
public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront()
=> _publisherVerification.Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront();
- [Test]
+ [SkippableFact]
public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected()
=> _publisherVerification.Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected();
- [Test]
+ [SkippableFact]
public void Required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe()
=> _publisherVerification.Required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe();
- [Test]
+ [SkippableFact]
public void Required_spec303_mustNotAllowUnboundedRecursion()
=> _publisherVerification.Required_spec303_mustNotAllowUnboundedRecursion();
- [Test]
+ [SkippableFact]
public void Untested_spec304_requestShouldNotPerformHeavyComputations()
=> _publisherVerification.Untested_spec304_requestShouldNotPerformHeavyComputations();
- [Test]
+ [SkippableFact]
public void Untested_spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation()
=> _publisherVerification.Untested_spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation();
- [Test]
+ [SkippableFact]
public void Required_spec306_afterSubscriptionIsCancelledRequestMustBeNops()
=> _publisherVerification.Required_spec306_afterSubscriptionIsCancelledRequestMustBeNops();
- [Test]
+ [SkippableFact]
public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops()
=> _publisherVerification.Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops();
- [Test]
+ [SkippableFact]
public void Required_spec309_requestZeroMustSignalIllegalArgumentException()
=> _publisherVerification.Required_spec309_requestZeroMustSignalIllegalArgumentException();
- [Test]
+ [SkippableFact]
public void Required_spec309_requestNegativeNumberMustSignalIllegalArgumentException()
=> _publisherVerification.Required_spec309_requestNegativeNumberMustSignalIllegalArgumentException();
- [Test]
+ [SkippableFact]
public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling()
=> _publisherVerification.Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling();
- [Test]
+ [SkippableFact]
public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber()
=> _publisherVerification.Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber();
- [Test]
+ [SkippableFact]
public void Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue()
=> _publisherVerification.Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue();
- [Test]
+ [SkippableFact]
public void Required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue()
=> _publisherVerification.Required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue();
- [Test]
+ [SkippableFact]
public void Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue()
=> _publisherVerification.Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue();
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4
// for multiple subscribers
- [Test]
+ [SkippableFact]
public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError()
=> OptionalMultipleSubscribersTest(2, setup =>
{
@@ -422,7 +424,7 @@ public void OnComplete()
// A Processor
// must immediately pass on `onError` events received from its upstream to its downstream
- [Test]
+ [SkippableFact]
public void MustImmediatelyPassOnOnErrorEventsReceivedFromItsUpstreamToItsDownstream()
{
var setup = new TestSetup(_environment, _processorBufferSize, 1, this);
@@ -439,85 +441,85 @@ public void MustImmediatelyPassOnOnErrorEventsReceivedFromItsUpstreamToItsDownst
/////////////////////// DELEGATED TESTS, A PROCESSOR "IS A" SUBSCRIBER //////////////////////
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#4.1
- [Test]
+ [SkippableFact]
public void Required_exerciseWhiteboxHappyPath()
=> _subscriberVerification.Required_exerciseWhiteboxHappyPath();
- [Test]
+ [SkippableFact]
public void Required_spec201_mustSignalDemandViaSubscriptionRequest()
=> _subscriberVerification.Required_spec201_mustSignalDemandViaSubscriptionRequest();
- [Test]
+ [SkippableFact]
public void Untested_spec202_shouldAsynchronouslyDispatch()
=> _subscriberVerification.Untested_spec202_shouldAsynchronouslyDispatch();
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete()
=> _subscriberVerification.Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete();
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError()
=> _subscriberVerification.Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError();
- [Test]
+ [SkippableFact]
public void Untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError()
=> _subscriberVerification.Untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError();
- [Test]
+ [SkippableFact]
public void Required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal()
=> _subscriberVerification.Required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal();
- [Test]
+ [SkippableFact]
public void Untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid()
=> _subscriberVerification.Untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid();
- [Test]
+ [SkippableFact]
public void Untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization()
=> _subscriberVerification.Untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization();
- [Test]
+ [SkippableFact]
public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel()
=> _subscriberVerification.Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel();
- [Test]
+ [SkippableFact]
public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall()
=> _subscriberVerification.Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall();
- [Test]
+ [SkippableFact]
public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall()
=> _subscriberVerification.Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall();
- [Test]
+ [SkippableFact]
public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall()
=> _subscriberVerification.Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall();
- [Test]
+ [SkippableFact]
public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall()
=> _subscriberVerification.Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall();
- [Test]
+ [SkippableFact]
public void Untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents()
=> _subscriberVerification.Untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents();
- [Test]
+ [SkippableFact]
public void Untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation()
=> _subscriberVerification.Untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation();
- [Test]
+ [SkippableFact]
public void Untested_spec213_failingOnSignalInvocation()
=> _subscriberVerification.Untested_spec213_failingOnSignalInvocation();
- [Test]
+ [SkippableFact]
public void Required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull()
=> _subscriberVerification.Required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull();
- [Test]
+ [SkippableFact]
public void Required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull()
=> _subscriberVerification.Required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull();
- [Test]
+ [SkippableFact]
public void Required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull()
=> _subscriberVerification.Required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull();
- [Test]
+ [SkippableFact]
public void Untested_spec301_mustNotBeCalledOutsideSubscriberContext()
=> _subscriberVerification.Untested_spec301_mustNotBeCalledOutsideSubscriberContext();
- [Test]
+ [SkippableFact]
public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced()
=> _subscriberVerification.Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced();
- [Test]
+ [SkippableFact]
public void Untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber()
=> _subscriberVerification.Untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber();
- [Test]
+ [SkippableFact]
public void Untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError()
=> _subscriberVerification.Untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError();
- [Test]
+ [SkippableFact]
public void Untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists()
=> _subscriberVerification.Untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists();
- [Test]
+ [SkippableFact]
public void Untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError()
=> _subscriberVerification.Untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError();
- [Test]
+ [SkippableFact]
public void Untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber()
=> _subscriberVerification.Untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber();
@@ -525,7 +527,7 @@ public void Untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscr
// A Processor
// must trigger `requestFromUpstream` for elements that have been requested 'long ago'
- [Test]
+ [SkippableFact]
public void Required_mustRequestFromUpstreamForElementsThatHaveBeenRequestedLongAgo()
{
OptionalMultipleSubscribersTest(2, setup =>
diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs
index 54fe6d9..3e0e3db 100644
--- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs
+++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs
@@ -4,11 +4,11 @@
using System;
using System.Collections.Generic;
using System.Threading;
-using NUnit.Framework;
+using FluentAssertions;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
-//using Reactive.Streams.TCK.Support;
-
namespace Reactive.Streams.TCK
{
public abstract class PublisherVerification : IPublisherVerificationRules
@@ -34,6 +34,7 @@ protected PublisherVerification(TestEnvironment environment, long publisherRefer
{
_environment = environment;
_publisherReferenceGcTimeoutMillis = publisherReferenceGcTimeoutMillis;
+ SetUp();
}
///
@@ -116,12 +117,11 @@ public static long EnvironmentPublisherReferenceGcTimeoutMilliseconds()
////////////////////// TEST ENV CLEANUP /////////////////////////////////////
- [SetUp]
public void SetUp() => _environment.ClearAsyncErrors();
////////////////////// TEST SETUP VERIFICATION //////////////////////////////
- [Test]
+ [SkippableFact]
public void Required_createPublisher1MustProduceAStreamOfExactly1Element()
{
Func, ManualSubscriber, Option> requestNextElementOrEndOfStream =
@@ -137,7 +137,7 @@ public void Required_createPublisher1MustProduceAStreamOfExactly1Element()
});
}
- [Test]
+ [SkippableFact]
public void Required_createPublisher3MustProduceAStreamOfExactly3Elements()
{
Func, ManualSubscriber, Option> requestNextElementOrEndOfStream =
@@ -155,11 +155,11 @@ public void Required_createPublisher3MustProduceAStreamOfExactly3Elements()
});
}
- [Test]
+ [SkippableFact]
public void Required_validate_maxElementsFromPublisher()
=> Assert.True(MaxElementsFromPublisher >= 0, "maxElementsFromPublisher MUST return a number >= 0");
- [Test]
+ [SkippableFact]
public void Required_validate_boundedDepthOfOnNextAndRequestRecursion()
=> Assert.True(BoundedDepthOfOnNextAndRequestRecursion >= 1, "boundedDepthOfOnNextAndRequestRecursion must return a number >= 1");
@@ -167,7 +167,7 @@ public void Required_validate_boundedDepthOfOnNextAndRequestRecursion()
////////////////////// SPEC RULE VERIFICATION ///////////////////////////////
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.1
- [Test]
+ [SkippableFact]
public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements()
=> ActivePublisherTest(5, false, publisher =>
{
@@ -193,7 +193,7 @@ public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfPr
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.2
- [Test]
+ [SkippableFact]
public void Required_spec102_maySignalLessThanRequestedAndTerminateSubscription()
{
const int elements = 3;
@@ -209,7 +209,7 @@ public void Required_spec102_maySignalLessThanRequestedAndTerminateSubscription(
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.3
- [Test]
+ [SkippableFact]
public void Stochastic_spec103_mustSignalOnMethodsSequentially()
{
const int iterations = 100;
@@ -335,7 +335,7 @@ public void OnComplete()
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4
- [Test]
+ [SkippableFact]
public void Optional_spec104_mustSignalOnErrorWhenFails()
{
try
@@ -354,7 +354,7 @@ public void Optional_spec104_mustSignalOnErrorWhenFails()
_environment.VerifyNoAsyncErrors();
});
}
- catch (IgnoreException)
+ catch (SkipException)
{
throw;
}
@@ -395,7 +395,7 @@ public override void OnError(Exception cause)
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.5
- [Test]
+ [SkippableFact]
public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates()
=> ActivePublisherTest(3, true, publisher =>
{
@@ -408,7 +408,7 @@ public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates()
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.5
- [Test]
+ [SkippableFact]
public void Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete()
=> OptionalActivePublisherTest(0, true, publisher =>
{
@@ -419,12 +419,12 @@ public void Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete()
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.6
- [Test]
+ [SkippableFact]
public void Untested_spec106_mustConsiderSubscriptionCancelledAfterOnErrorOrOnCompleteHasBeenCalled()
=> NotVerified(); // not really testable without more control over the Publisher
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.7
- [Test]
+ [SkippableFact]
public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled()
=> ActivePublisherTest(1, true, publisher =>
{
@@ -438,22 +438,22 @@ public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSigna
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.7
- [Test]
+ [SkippableFact]
public void Untested_spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled()
=> NotVerified(); // can we meaningfully test this, without more control over the publisher?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.8
- [Test]
+ [SkippableFact]
public void Untested_spec108_possiblyCanceledSubscriptionShouldNotReceiveOnErrorOrOnCompleteSignals()
=> NotVerified(); // can we meaningfully test this?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
- [Test]
+ [SkippableFact]
public void Untested_spec109_subscribeShouldNotThrowNonFatalThrowable()
=> NotVerified(); // can we meaningfully test this?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
- [Test]
+ [SkippableFact]
public void Required_spec109_subscribeThrowNPEOnNullSubscriber()
=> ActivePublisherTest(0, false, publisher =>
{
@@ -472,7 +472,7 @@ public void Required_spec109_subscribeThrowNPEOnNullSubscriber()
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
- [Test]
+ [SkippableFact]
public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber()
=> ActivePublisherTest(0, false, publisher =>
{
@@ -524,7 +524,7 @@ public void OnComplete()
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9
- [Test]
+ [SkippableFact]
public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe()
=> WhenHasErrorPublisherTest(publisher =>
{
@@ -566,12 +566,12 @@ public override void OnSubscribe(ISubscription subscription)
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.10
- [Test]
+ [SkippableFact]
public void Untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice()
=> NotVerified(); // can we meaningfully test this?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11
- [Test]
+ [SkippableFact]
public void Optional_spec111_maySupportMultiSubscribe()
=> OptionalActivePublisherTest(1, false, publisher =>
{
@@ -595,7 +595,7 @@ public void Optional_spec111_maySupportMultiSubscribe()
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11
- [Test]
+ [SkippableFact]
public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne()
=> OptionalActivePublisherTest(5, true, publisher =>
{
@@ -645,13 +645,13 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen
check2.Add(z2);
check2.Add(z3);
- Assert.AreEqual(r, check1, $"Publisher {publisher} did not produce the same element sequence for subscribers 1 and 2");
- Assert.AreEqual(r, check2, $"Publisher {publisher} did not produce the same element sequence for subscribers 1 and 3");
+ r.Should().BeEquivalentTo(check1, $"Publisher {publisher} did not produce the same element sequence for subscribers 1 and 2");
+ r.Should().BeEquivalentTo(check2, $"Publisher {publisher} did not produce the same element sequence for subscribers 1 and 3");
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11
- [Test]
+ [SkippableFact]
public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront()
=> OptionalActivePublisherTest(3, false, publisher =>
{
@@ -672,13 +672,14 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen
// NOTE: can't check completion, the Publisher may not be able to signal it
// a similar test *with* completion checking is implemented
-
- Assert.AreEqual(received1, received2, "Expected elements to be signaled in the same sequence to 1st and 2nd subscribers");
- Assert.AreEqual(received2, received3, "Expected elements to be signaled in the same sequence to 2st and 3nd subscribers");
+ received1.Should().BeEquivalentTo(received2,
+ "Expected elements to be signaled in the same sequence to 1st and 2nd subscribers");
+ received2.Should().BeEquivalentTo(received3,
+ "Expected elements to be signaled in the same sequence to 2st and 3nd subscribers");
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11
- [Test]
+ [SkippableFact]
public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected()
=> OptionalActivePublisherTest(3, true, publisher =>
{
@@ -700,14 +701,16 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen
sub2.ExpectCompletion();
sub3.ExpectCompletion();
- Assert.AreEqual(received1, received2, "Expected elements to be signaled in the same sequence to 1st and 2nd subscribers");
- Assert.AreEqual(received2, received3, "Expected elements to be signaled in the same sequence to 2st and 3nd subscribers");
+ received1.Should().BeEquivalentTo(received2,
+ "Expected elements to be signaled in the same sequence to 1st and 2nd subscribers");
+ received2.Should().BeEquivalentTo(received3,
+ "Expected elements to be signaled in the same sequence to 2st and 3nd subscribers");
});
///////////////////// SUBSCRIPTION TESTS //////////////////////////////////
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.2
- [Test]
+ [SkippableFact]
public void Required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe()
=> ActivePublisherTest(6, false, publisher =>
{
@@ -738,7 +741,7 @@ public override void OnNext(T element)
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.3
- [Test]
+ [SkippableFact]
public void Required_spec303_mustNotAllowUnboundedRecursion()
{
var oneMoreThanBoundedLimit = BoundedDepthOfOnNextAndRequestRecursion + 1;
@@ -835,17 +838,17 @@ public override void OnError(Exception cause)
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.4
- [Test]
+ [SkippableFact]
public void Untested_spec304_requestShouldNotPerformHeavyComputations()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.5
- [Test]
+ [SkippableFact]
public void Untested_spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.6
- [Test]
+ [SkippableFact]
public void Required_spec306_afterSubscriptionIsCancelledRequestMustBeNops()
=> ActivePublisherTest(3, false, publisher =>
{
@@ -880,7 +883,7 @@ public override void Cancel()
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.7
- [Test]
+ [SkippableFact]
public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops()
=> ActivePublisherTest(1, false, publisher =>
{
@@ -898,7 +901,7 @@ public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsM
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.9
- [Test]
+ [SkippableFact]
public void Required_spec309_requestZeroMustSignalIllegalArgumentException()
=> ActivePublisherTest(10, false, publisher =>
{
@@ -908,7 +911,7 @@ public void Required_spec309_requestZeroMustSignalIllegalArgumentException()
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.9
- [Test]
+ [SkippableFact]
public void Required_spec309_requestNegativeNumberMustSignalIllegalArgumentException()
=> ActivePublisherTest(10, false, publisher =>
{
@@ -919,7 +922,7 @@ public void Required_spec309_requestNegativeNumberMustSignalIllegalArgumentExcep
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.12
- [Test]
+ [SkippableFact]
public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling()
{
// the publisher is able to signal more elements than the subscriber will be requesting in total
@@ -977,7 +980,7 @@ public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.13
- [Test]
+ [SkippableFact]
public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber()
{
Func, WeakReference>> run = publisher =>
@@ -1010,7 +1013,7 @@ public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferenc
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.17
- [Test]
+ [SkippableFact]
public void Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue()
{
const int totalElements = 3;
@@ -1028,7 +1031,7 @@ public void Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue()
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.17
- [Test]
+ [SkippableFact]
public void Required_spec317_mustSupportACumulativePendingElementCountUpToLongMaxValue()
{
const int totalElements = 3;
@@ -1055,7 +1058,7 @@ public void Required_spec317_mustSupportACumulativePendingElementCountUpToLongMa
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.17
- [Test]
+ [SkippableFact]
public void Required_spec317_mustNotSignalOnErrorWhenPendingAboveLongMaxValue()
=> ActivePublisherTest(int.MaxValue, false, publisher =>
{
@@ -1120,9 +1123,9 @@ public override void OnNext(T element)
public void ActivePublisherTest(long elements, bool completionSignalRequired, Action> run)
{
if (elements > MaxElementsFromPublisher)
- Assert.Ignore($"Uable to run this test as required elements nr : {elements} is higher than supported by given producer {MaxElementsFromPublisher}");
+ TckAssert.Skip($"Uable to run this test as required elements nr : {elements} is higher than supported by given producer {MaxElementsFromPublisher}");
if (completionSignalRequired && MaxElementsFromPublisher == long.MaxValue)
- Assert.Ignore("Unable to run this test, as it requires an onComplete signal, which this Publisher is unable to provide (as signalled by returning long.MaxValue from `MaxElementsFromPublisher");
+ TckAssert.Skip("Unable to run this test, as it requires an onComplete signal, which this Publisher is unable to provide (as signalled by returning long.MaxValue from `MaxElementsFromPublisher");
var publisher = CreatePublisher(elements);
run(publisher);
@@ -1140,9 +1143,9 @@ public void ActivePublisherTest(long elements, bool completionSignalRequired, Ac
public void OptionalActivePublisherTest(long elements, bool completionSignalRequired, Action> run)
{
if (elements > MaxElementsFromPublisher)
- Assert.Ignore($"Uable to run this test as required elements nr : {elements} is higher than supported by given producer {MaxElementsFromPublisher}");
+ TckAssert.Skip($"Uable to run this test as required elements nr : {elements} is higher than supported by given producer {MaxElementsFromPublisher}");
if (completionSignalRequired && MaxElementsFromPublisher == long.MaxValue)
- Assert.Ignore("Unable to run this test, as it requires an onComplete signal, which this Publisher is unable to provide (as signalled by returning long.MaxValue from `MaxElementsFromPublisher");
+ TckAssert.Skip("Unable to run this test, as it requires an onComplete signal, which this Publisher is unable to provide (as signalled by returning long.MaxValue from `MaxElementsFromPublisher");
var publisher = CreatePublisher(elements);
var skipMessage = "Skipped because tested publisher does NOT implement this OPTIONAL requirement.";
@@ -1155,10 +1158,12 @@ public void OptionalActivePublisherTest(long elements, bool completionSignalRequ
{
NotVerified(skipMessage + "Reason for skipping was: " + ex.Message);
}
+ /*
catch (Exception)
{
NotVerified(skipMessage);
}
+ */
}
public const string SkippingNoErrorPublisherAvailable =
@@ -1182,7 +1187,7 @@ public void PotentiallyPendingTest(IPublisher publisher, Action
if (publisher != null)
run(publisher);
else
- Assert.Ignore(message);
+ TckAssert.Skip(message);
}
///
@@ -1192,7 +1197,7 @@ public void PotentiallyPendingTest(IPublisher publisher, Action
public void StochasticTest(int n, Action body)
{
if (SkipStochasticTests)
- Assert.Ignore("Skipping @Stochastic test because `SkipStochasticTests` returned `true`!");
+ TckAssert.Skip("Skipping @Stochastic test because `SkipStochasticTests` returned `true`!");
for (var i = 0; i < n; i++)
body(i);
@@ -1200,7 +1205,7 @@ public void StochasticTest(int n, Action body)
public void NotVerified() => NotVerified("Not verified by this TCK.");
- public void NotVerified(string message) => Assert.Ignore(message);
+ public void NotVerified(string message) => TckAssert.Skip(message);
///
/// Return this value from to mark that the given ,
diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj
index db49c51..3cb403e 100644
--- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj
+++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj
@@ -6,7 +6,7 @@
MIT-0
1.0.3
Reactive Streams
- net45
+ netstandard2.0
reactive;stream
https://github.com/reactive-streams/reactive-streams-dotnet
http://creativecommons.org/publicdomain/zero/1.0/
@@ -19,7 +19,9 @@
-
+
+
+
diff --git a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs
index 79162cc..05ca09b 100644
--- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs
+++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs
@@ -4,7 +4,8 @@
using System;
using System.Diagnostics;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
namespace Reactive.Streams.TCK
@@ -25,6 +26,8 @@ public abstract class SubscriberBlackboxVerification : WithHelperPublisher
protected SubscriberBlackboxVerification(TestEnvironment environment)
{
Environment = environment;
+
+ Setup();
}
// USER API
@@ -47,13 +50,12 @@ public virtual void TriggerRequest(ISubscriber subscriber)
////////////////////// TEST ENV CLEANUP /////////////////////////////////////
- [SetUp]
public void Setup() => Environment.ClearAsyncErrors();
////////////////////// SPEC RULE VERIFICATION ///////////////////////////////
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.1
- [Test]
+ [SkippableFact]
public void Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest()
=> BlackboxSubscriberTest(stage =>
{
@@ -66,12 +68,12 @@ public void Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest()
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.2
- [Test]
+ [SkippableFact]
public void Untested_spec202_blackbox_shouldAsynchronouslyDispatch()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.3
- [Test]
+ [SkippableFact]
public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete()
=> BlackboxSubscriberWithoutSetupTest(stage =>
{
@@ -84,7 +86,7 @@ public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublishe
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.3
- [Test]
+ [SkippableFact]
public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnError()
=> BlackboxSubscriberWithoutSetupTest(stage =>
{
@@ -127,12 +129,12 @@ public void Cancel()
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.4
- [Test]
+ [SkippableFact]
public void Untested_spec204_blackbox_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.5
- [Test]
+ [SkippableFact]
public void
Required_spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal
()
@@ -169,12 +171,12 @@ public void Request(long n)
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.6
- [Test]
+ [SkippableFact]
public void Untested_spec206_blackbox_mustCallSubscriptionCancelIfItIsNoLongerValid()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.7
- [Test]
+ [SkippableFact]
public void
Untested_spec207_blackbox_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization
()
@@ -182,12 +184,12 @@ public void
// the same thread part of the clause can be verified but that is not very useful, or is it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.8
- [Test]
+ [SkippableFact]
public void Untested_spec208_blackbox_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.9
- [Test]
+ [SkippableFact]
public void Required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall()
=> BlackboxSubscriberWithoutSetupTest(stage =>
{
@@ -241,7 +243,7 @@ public void Subscribe(ISubscriber subscriber)
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.9
- [Test]
+ [SkippableFact]
public void Required_spec209_blackbox_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall()
=> BlackboxSubscriberWithoutSetupTest(stage =>
{
@@ -261,7 +263,7 @@ private sealed class Spec209WithoutPublisher : IPublisher
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.10
- [Test]
+ [SkippableFact]
public void Required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall()
=> BlackboxSubscriberTest(stage =>
{
@@ -270,24 +272,24 @@ public void Required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWith
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.11
- [Test]
+ [SkippableFact]
public void
Untested_spec211_blackbox_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents
()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.12
- [Test]
+ [SkippableFact]
public void Untested_spec212_blackbox_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Untested_spec213_blackbox_failingOnSignalInvocation()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Required_spec213_blackbox_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull()
=> BlackboxSubscriberWithoutSetupTest(stage =>
{
@@ -309,13 +311,13 @@ public void Required_spec213_blackbox_onSubscribe_mustThrowNullPointerExceptionW
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenParametersAreNull()
=> BlackboxSubscriberWithoutSetupTest(stage =>
{
var element = default(T);
if(element != null)
- throw new IgnoreException("Can't verify behavior for value types");
+ throw new SkipException("Can't verify behavior for value types");
var subscriber = CreateSubscriber();
var gotNpe = false;
@@ -335,7 +337,7 @@ public void Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenPa
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Required_spec213_blackbox_onError_mustThrowNullPointerExceptionWhenParametersAreNull()
=> BlackboxSubscriberWithoutSetupTest(stage =>
{
@@ -371,37 +373,37 @@ public void Cancel()
////////////////////// SUBSCRIPTION SPEC RULE VERIFICATION //////////////////
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.1
- [Test]
+ [SkippableFact]
public void Untested_spec301_blackbox_mustNotBeCalledOutsideSubscriberContext()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.8
- [Test]
+ [SkippableFact]
public void Untested_spec308_blackbox_requestMustRegisterGivenNumberElementsToBeProduced()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.10
- [Test]
+ [SkippableFact]
public void Untested_spec310_blackbox_requestMaySynchronouslyCallOnNextOnSubscriber()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.11
- [Test]
+ [SkippableFact]
public void Untested_spec311_blackbox_requestMaySynchronouslyCallOnCompleteOrOnError()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.14
- [Test]
+ [SkippableFact]
public void Untested_spec314_blackbox_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.15
- [Test]
+ [SkippableFact]
public void Untested_spec315_blackbox_cancelMustNotThrowExceptionAndMustSignalOnError()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.16
- [Test]
+ [SkippableFact]
public void Untested_spec316_blackbox_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber()
=> NotVerified(); // cannot be meaningfully tested, or can it?
@@ -417,7 +419,7 @@ public void BlackboxSubscriberWithoutSetupTest(Action> body
public void NotVerified() => NotVerified("Not verified using this TCK.");
- public void NotVerified(string message) => Assert.Ignore(message);
+ public void NotVerified(string message) => TckAssert.Skip(message);
}
public class BlackBoxTestStage : ManualPublisher
diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs
index b7d819f..ce8cc72 100644
--- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs
+++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs
@@ -4,7 +4,8 @@
using System;
using System.Diagnostics;
using System.Linq;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
namespace Reactive.Streams.TCK
@@ -20,6 +21,7 @@ public abstract class SubscriberWhiteboxVerification : WithHelperPublisher
protected SubscriberWhiteboxVerification(TestEnvironment environment)
{
_environment = environment;
+ SetUp();
}
// USER API
@@ -35,13 +37,12 @@ protected SubscriberWhiteboxVerification(TestEnvironment environment)
////////////////////// TEST ENV CLEANUP /////////////////////////////////////
- [SetUp]
public void SetUp() => _environment.ClearAsyncErrors();
////////////////////// TEST SETUP VERIFICATION //////////////////////////////
- [Test]
+ [SkippableFact]
public void Required_exerciseWhiteboxHappyPath()
=> SubscriberTest(stage =>
{
@@ -69,7 +70,7 @@ public void Required_exerciseWhiteboxHappyPath()
////////////////////// SPEC RULE VERIFICATION ///////////////////////////////
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.1
- [Test]
+ [SkippableFact]
public void Required_spec201_mustSignalDemandViaSubscriptionRequest()
=> SubscriberTest(stage =>
{
@@ -80,12 +81,12 @@ public void Required_spec201_mustSignalDemandViaSubscriptionRequest()
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.2
- [Test]
+ [SkippableFact]
public void Untested_spec202_shouldAsynchronouslyDispatch()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.3
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComplete()
=> SubscriberTestWithoutSetup(stage =>
{
@@ -131,7 +132,7 @@ public void Cancel()
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.3
- [Test]
+ [SkippableFact]
public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError()
=> SubscriberTestWithoutSetup(stage =>
{
@@ -176,12 +177,12 @@ public void Cancel()
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.4
- [Test]
+ [SkippableFact]
public void Untested_spec204_mustConsiderTheSubscriptionAsCancelledInAfterRecievingOnCompleteOrOnError()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.5
- [Test]
+ [SkippableFact]
public void Required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal()
=> SubscriberTest(stage =>
{
@@ -217,18 +218,18 @@ public void Request(long n)
}
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.6
- [Test]
+ [SkippableFact]
public void Untested_spec206_mustCallSubscriptionCancelIfItIsNoLongerValid()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.7
- [Test]
+ [SkippableFact]
public void Untested_spec207_mustEnsureAllCallsOnItsSubscriptionTakePlaceFromTheSameThreadOrTakeCareOfSynchronization()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// the same thread part of the clause can be verified but that is not very useful, or is it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.8
- [Test]
+ [SkippableFact]
public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCalledSubscriptionCancel()
=> SubscriberTest(stage =>
{
@@ -243,7 +244,7 @@ public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCall
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.9
- [Test]
+ [SkippableFact]
public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall()
=> SubscriberTest(stage =>
{
@@ -255,7 +256,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPreced
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.9
- [Test]
+ [SkippableFact]
public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall()
=> SubscriberTest(stage =>
{
@@ -266,7 +267,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPre
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.10
- [Test]
+ [SkippableFact]
public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall()
=> SubscriberTest(stage =>
{
@@ -281,7 +282,7 @@ public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPreceding
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.10
- [Test]
+ [SkippableFact]
public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall()
=> SubscriberTest(stage =>
{
@@ -293,22 +294,22 @@ public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPreced
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.11
- [Test]
+ [SkippableFact]
public void Untested_spec211_mustMakeSureThatAllCallsOnItsMethodsHappenBeforeTheProcessingOfTheRespectiveEvents()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.12
- [Test]
+ [SkippableFact]
public void Untested_spec212_mustNotCallOnSubscribeMoreThanOnceBasedOnObjectEquality_specViolation()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Untested_spec213_failingOnSignalInvocation()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParametersAreNull()
=> SubscriberTest(stage =>
{
@@ -328,13 +329,13 @@ public void Required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParame
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersAreNull()
=> SubscriberTest(stage =>
{
var element = default(T);
if (element != null)
- throw new IgnoreException("Can't verify behavior for value types");
+ throw new SkipException("Can't verify behavior for value types");
var subscriber = stage.Sub;
var gotNpe = false;
@@ -352,7 +353,7 @@ public void Required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersA
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#2.13
- [Test]
+ [SkippableFact]
public void Required_spec213_onError_mustThrowNullPointerExceptionWhenParametersAreNull()
=> SubscriberTest(stage =>
{
@@ -374,12 +375,12 @@ public void Required_spec213_onError_mustThrowNullPointerExceptionWhenParameters
////////////////////// SUBSCRIPTION SPEC RULE VERIFICATION //////////////////
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.1
- [Test]
+ [SkippableFact]
public void Untested_spec301_mustNotBeCalledOutsideSubscriberContext()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.8
- [Test]
+ [SkippableFact]
public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced()
=> SubscriberTest(stage =>
{
@@ -394,27 +395,27 @@ public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced(
});
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.10
- [Test]
+ [SkippableFact]
public void Untested_spec310_requestMaySynchronouslyCallOnNextOnSubscriber()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.11
- [Test]
+ [SkippableFact]
public void Untested_spec311_requestMaySynchronouslyCallOnCompleteOrOnError()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.14
- [Test]
+ [SkippableFact]
public void Untested_spec314_cancelMayCauseThePublisherToShutdownIfNoOtherSubscriptionExists()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.15
- [Test]
+ [SkippableFact]
public void Untested_spec315_cancelMustNotThrowExceptionAndMustSignalOnError()
=> NotVerified(); // cannot be meaningfully tested, or can it?
// Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.16
- [Test]
+ [SkippableFact]
public void Untested_spec316_requestMustNotThrowExceptionAndMustOnErrorTheSubscriber()
=> NotVerified(); // cannot be meaningfully tested, or can it?
@@ -458,7 +459,7 @@ public void OptionalSubscriberTestWithoutSetup(Action> body
public void NotVerified() => NotVerified("Not verified using this TCK.");
- public void NotVerified(string message) => Assert.Ignore(message);
+ public void NotVerified(string message) => TckAssert.Skip(message);
}
public class WhiteboxTestStage : ManualPublisher
diff --git a/src/tck/Reactive.Streams.TCK/Support/AssertionException.cs b/src/tck/Reactive.Streams.TCK/Support/AssertionException.cs
new file mode 100644
index 0000000..2d7ff8e
--- /dev/null
+++ b/src/tck/Reactive.Streams.TCK/Support/AssertionException.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Reactive.Streams.TCK.Support
+{
+ ///
+ /// Thrown when an assertion failed.
+ ///
+ [Serializable]
+ public class AssertionException : Exception
+ {
+ /// The error message that explains
+ /// the reason for the exception
+ public AssertionException(string message) : base(message)
+ { }
+
+ /// The error message that explains
+ /// the reason for the exception
+ /// The exception that caused the
+ /// current exception
+ public AssertionException(string message, Exception inner) :
+ base(message, inner)
+ { }
+
+#if SERIALIZATION
+ ///
+ /// Serialization Constructor
+ ///
+ protected AssertionException(System.Runtime.Serialization.SerializationInfo info,
+ System.Runtime.Serialization.StreamingContext context) : base(info,context)
+ {}
+#endif
+
+ /*
+ ///
+ /// Gets the ResultState provided by this exception
+ ///
+ public override ResultState ResultState
+ {
+ get { return ResultState.Failure; }
+ }
+ */
+ }
+}
diff --git a/src/tck/Reactive.Streams.TCK/Support/TckAssert.cs b/src/tck/Reactive.Streams.TCK/Support/TckAssert.cs
new file mode 100644
index 0000000..9d7ccde
--- /dev/null
+++ b/src/tck/Reactive.Streams.TCK/Support/TckAssert.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xunit;
+
+namespace Reactive.Streams.TCK.Support
+{
+ public static class TckAssert
+ {
+ #region Fail
+
+ ///
+ /// Throws an with the message and arguments
+ /// that are passed in. This is used by the other Assert functions.
+ ///
+ /// The message to initialize the with.
+ /// Arguments to be used in formatting the message
+ public static void Fail(string message, params object[] args)
+ {
+ if (message == null) message = string.Empty;
+ else if (args != null && args.Length > 0)
+ message = string.Format(message, args);
+
+ throw new AssertionException(message);
+ //ReportFailure(message);
+ }
+
+ ///
+ /// Throws an with the message that is
+ /// passed in. This is used by the other Assert functions.
+ ///
+ /// The message to initialize the with.
+ public static void Fail(string message)
+ {
+ Fail(message, null);
+ }
+
+ ///
+ /// Throws an .
+ /// This is used by the other Assert functions.
+ ///
+ public static void Fail()
+ {
+ Fail(string.Empty, null);
+ }
+
+ #endregion
+
+ #region Skip
+
+ ///
+ /// Throws an with the message and arguments
+ /// that are passed in. This causes the test to be reported as ignored.
+ ///
+ /// The message to initialize the with.
+ /// Arguments to be used in formatting the message
+ public static void Skip(string message, params object[] args)
+ {
+ if (message == null) message = string.Empty;
+ else if (args != null && args.Length > 0)
+ message = string.Format(message, args);
+
+ /*
+ // If we are in a multiple assert block, this is an error
+ if (TestExecutionContext.CurrentContext.MultipleAssertLevel > 0)
+ throw new Exception("Assert.Ignore may not be used in a multiple assertion block.");
+ */
+
+ throw new SkipException(message);
+ }
+
+ ///
+ /// Throws an with the message that is
+ /// passed in. This causes the test to be reported as ignored.
+ ///
+ /// The message to initialize the with.
+ public static void Skip(string message)
+ {
+ Skip(message, null);
+ }
+
+ ///
+ /// Throws an .
+ /// This causes the test to be reported as ignored.
+ ///
+ public static void Skip()
+ {
+ Skip(string.Empty, null);
+ }
+
+ #endregion
+ }
+}
diff --git a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs
index 8a06a3b..e1f8362 100644
--- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs
+++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs
@@ -5,7 +5,8 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Threading;
-using NUnit.Framework;
+using Xunit;
+using Xunit.Abstractions;
using Reactive.Streams.TCK.Support;
namespace Reactive.Streams.TCK
@@ -17,6 +18,7 @@ public class TestEnvironment
private const long DefaultTimeoutMillis = 500;
private const string DefaultNoSignalsTimeoutMillisEnv = "DEFAULT_NO_SIGNALS_TIMEOUT_MILLIS";
+ public ITestOutputHelper Output { get; }
///
/// Tests must specify the timeout for expected outcome of asynchronous
@@ -26,12 +28,12 @@ public class TestEnvironment
///
/// default timeout to be used in all expect* methods
/// default timeout to be used when no further signals are expected anymore
- /// if true, signals such as OnNext / Request / OnComplete etc will be printed to standard output. Default: false
- public TestEnvironment(long defaultTimeoutMilliseconds, long defaultNoSignalsTimeoutMilliseconds, bool writeLineDebug = false)
+ /// if not null, signals such as OnNext / Request / OnComplete etc will be printed to standard output. Default: null
+ public TestEnvironment(long defaultTimeoutMilliseconds, long defaultNoSignalsTimeoutMilliseconds, ITestOutputHelper output = null)
{
DefaultTimeoutMilliseconds = defaultTimeoutMilliseconds;
DefaultNoSignalsTimeoutMilliseconds = defaultNoSignalsTimeoutMilliseconds;
- WriteLineDebug = writeLineDebug;
+ Output = output;
}
///
@@ -41,8 +43,11 @@ public TestEnvironment(long defaultTimeoutMilliseconds, long defaultNoSignalsTim
/// run the tests.
///
/// default timeout to be used in all expect* methods
- public TestEnvironment(long defaultTimeoutMilliseconds)
- : this(defaultTimeoutMilliseconds, defaultTimeoutMilliseconds)
+ public TestEnvironment(long defaultTimeoutMilliseconds, ITestOutputHelper output)
+ : this(
+ defaultTimeoutMilliseconds,
+ defaultTimeoutMilliseconds,
+ output)
{
}
@@ -53,11 +58,11 @@ public TestEnvironment(long defaultTimeoutMilliseconds)
/// run the tests.
///
/// if true, signals such as OnNext / Request / OnComplete etc will be printed to standard output
- public TestEnvironment(bool writeLineDebug)
+ public TestEnvironment(bool writeLineDebug, ITestOutputHelper output)
: this(
EnvironmentDefaultTimeoutMilliseconds(),
- EnvironmentDefaultNoSignalsTimeoutMilliseconds(),
- writeLineDebug)
+ EnvironmentDefaultNoSignalsTimeoutMilliseconds(),
+ output)
{
}
@@ -67,8 +72,11 @@ public TestEnvironment(bool writeLineDebug)
/// the implementation, but can in some cases result in longer time to
/// run the tests.
///
- public TestEnvironment()
- : this(EnvironmentDefaultTimeoutMilliseconds(), EnvironmentDefaultNoSignalsTimeoutMilliseconds())
+ public TestEnvironment(ITestOutputHelper output)
+ : this(
+ EnvironmentDefaultTimeoutMilliseconds(),
+ EnvironmentDefaultNoSignalsTimeoutMilliseconds(),
+ output)
{
}
@@ -83,11 +91,6 @@ public TestEnvironment()
///
public long DefaultNoSignalsTimeoutMilliseconds { get; }
- ///
- /// If true, signals such as OnNext / Request / OnComplete etc will be printed to standard output
- ///
- public bool WriteLineDebug { get; }
-
public ConcurrentQueue AsyncErrors { get; } = new ConcurrentQueue();
///
@@ -150,7 +153,7 @@ public void Flop(string message)
{
try
{
- Assert.Fail(message);
+ TckAssert.Fail(message);
}
catch (Exception ex)
{
@@ -174,7 +177,7 @@ public void Flop(Exception exception, string message)
{
try
{
- Assert.Fail(message, exception);
+ TckAssert.Fail(message, exception);
}
catch (Exception)
{
@@ -198,7 +201,7 @@ public void Flop(Exception exception)
{
try
{
- Assert.Fail(exception.Message, exception);
+ TckAssert.Fail(exception.Message, exception);
}
catch (Exception)
{
@@ -222,12 +225,12 @@ public T FlopAndFail(string message)
{
try
{
- Assert.Fail(message);
+ TckAssert.Fail(message);
}
catch (Exception ex)
{
AsyncErrors.Enqueue(ex);
- Assert.Fail(message, ex);
+ TckAssert.Fail(message, ex);
}
return default(T); // unreachable, the previous block will always exit by throwing
@@ -306,21 +309,19 @@ public void VerifyNoAsyncErrorsNoDelay()
{
foreach (var error in AsyncErrors)
{
- var exception = error as AssertionException;
- if (exception != null)
+ if (error is AssertionException exception)
throw exception;
- Assert.Fail($"Async error during test execution: {error.Message}", error);
+ TckAssert.Fail($"Async error during test execution: {error.Message}", error);
}
}
///
- /// If is true, print debug message to std out.
+ /// If is not null, print debug message to std out.
///
public void Debug(string message)
{
- if(WriteLineDebug)
- Console.WriteLine($"[TCK-DEBUG] {message}");
+ Output?.WriteLine($"[TCK-DEBUG] {message}");
}
///