From a38abc3f94594a3025c8a2a9c76aefd10c93909a Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 19:44:51 +0700 Subject: [PATCH 01/55] Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact] --- .gitignore | 3 +- .../Reactive.Streams/Reactive.Streams.csproj | 3 +- .../AsyncSubscriberTest.cs | 5 +- .../IterablePublisherTest.cs | 3 +- ...ctive.Streams.Example.Unicast.Tests.csproj | 9 +- .../SyncSubscriberTest.cs | 3 +- .../SyncSubscriberWhiteboxTest.cs | 3 +- .../UnboundedIntegerIncrementPublisherTest.cs | 3 +- .../Reactive.Streams.Example.Unicast.csproj | 6 +- src/tck/README.md | 10 +- .../EmptyLazyPublisherTest.cs | 4 +- ...tityProcessorVerificationDelegationTest.cs | 13 +- .../IdentityProcessorVerificationTest.cs | 7 +- .../PublisherVerificationTest.cs | 73 ++++----- .../RangePublisherTest.cs | 3 +- .../Reactive.Streams.TCK.Tests.csproj | 9 +- .../SingleElementPublisherTest.cs | 3 +- .../SubscriberBlackboxVerificationTest.cs | 31 ++-- .../SubscriberWhiteboxVerificationTest.cs | 29 ++-- .../Support/TCKVerificationSupport.cs | 3 +- .../SyncTriggeredDemandSubscriberTest.cs | 3 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 3 +- .../IdentityProcessorVerification.cs | 138 +++++++++--------- .../PublisherVerification.cs | 78 +++++----- .../Reactive.Streams.TCK.csproj | 6 +- .../SubscriberBlackboxVerification.cs | 56 +++---- .../SubscriberWhiteboxVerification.cs | 59 ++++---- .../Reactive.Streams.TCK/TestEnvironment.cs | 3 +- 28 files changed, 297 insertions(+), 272 deletions(-) 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/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index aad21f6..0f1fb51 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -6,11 +6,10 @@ CC0 1.0 Universal 1.0.3 Reactive Streams - netstandard1.0;net45 + netstandard2.0;net452 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 1fe3c62..6435138 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -1,6 +1,7 @@ using System; using System.Threading; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; using Reactive.Streams.TCK.Support; @@ -22,7 +23,7 @@ private sealed class Suscriber : AsyncSubscriber protected override bool WhenNext(int? element) => true; } - [Test] + [SkippableFact] public void TestAccumulation() { var i = new AtomicCounterLong(0); diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index a62e30c..7a22b01 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -1,7 +1,8 @@ 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 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..0736f03 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 win7-x64 @@ -12,9 +12,10 @@ - - - + + + + diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index 3567681..9a9bc40 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; namespace Reactive.Streams.Example.Unicast.Tests diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index b3b3df5..45d76c1 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; namespace Reactive.Streams.Example.Unicast.Tests diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 7d3bced..38a7e43 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -1,7 +1,8 @@ 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 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..f7f1b36 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;net452 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 7db2d31..53ce92f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -1,10 +1,10 @@ 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()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs index f2ef0c1..16a55f7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs @@ -3,7 +3,8 @@ using System.Linq; using System.Reflection; using System.Text; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; namespace Reactive.Streams.TCK.Tests { @@ -16,7 +17,7 @@ namespace Reactive.Streams.TCK.Tests /// public class IdentityProcessorVerificationDelegationTest { - [Test] + [SkippableFact] public void ShouldIncludeAllTestsFromPublisherVerification() { var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList(); @@ -25,7 +26,7 @@ public void ShouldIncludeAllTestsFromPublisherVerification() typeof(PublisherVerification<>), publisherTests); } - [Test] + [SkippableFact] public void ShouldIncludeAllTestsFromSubscriberVerification() { var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList(); @@ -42,7 +43,7 @@ private static void AssertSuiteDelegatedAllTests(Type delegatingFrom, IList delegate{targetClass.Name}.{targetTest}();"); Assert.True(TestsInclude(allTests, targetTest), message.ToString()); @@ -54,7 +55,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 52542ed..4e59f32 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests @@ -11,7 +12,7 @@ public class IdentityProcessorVerificationTest : TCKVerificationSupport private static readonly long DefaultNoSignalsTimeoutMilliseconds = TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds(); - [Test] + [SkippableFact] public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldBeIgnored() { RequireTestSkip(() => @@ -98,7 +99,7 @@ public Spec104WaitingVerification(TestEnvironment environment, long publisherRef public override IPublisher CreateFailedPublisher() => null; } - [Test] + [SkippableFact] public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldFailWhileWaitingForOnError() { RequireTestFailure(() => diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index 0fb7a2a..d0da450 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -1,7 +1,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; @@ -13,22 +14,22 @@ namespace Reactive.Streams.TCK.Tests /// public class PublisherVerificationTest : TCKVerificationSupport { - [Test] + [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()); @@ -94,7 +95,7 @@ public void Subscribe(ISubscriber subscriber) })); } - [Test] + [SkippableFact] public void Stochastic_spec103_mustSignalOnMethodsSequentially_shouldPass_forSynchronousPublisher() { var publisher = new LamdaPublisher(onSubscribe: subscriber => @@ -112,7 +113,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 => @@ -124,12 +125,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 => @@ -150,7 +151,7 @@ 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()); @@ -184,7 +185,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(); @@ -202,7 +203,7 @@ public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSigna } } - [Test] + [SkippableFact] public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled_shouldFailForPublisherWhichCompletesButKeepsServingData() { var publisher = new LamdaPublisher(onSubscribe: subscriber => @@ -228,7 +229,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 => { }); @@ -237,7 +238,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 => @@ -249,7 +250,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()); @@ -258,7 +259,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)); @@ -267,7 +268,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())); @@ -276,7 +277,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())); @@ -285,25 +286,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(); @@ -320,12 +321,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 => @@ -340,16 +341,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 => @@ -364,17 +365,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(); @@ -392,7 +393,7 @@ public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling } } - [Test] + [SkippableFact] public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber_shouldFailBy_keepingTheReferenceLongerThanNeeded() { ISubscriber sub; @@ -414,7 +415,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(); @@ -432,12 +433,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; @@ -459,7 +460,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; @@ -481,7 +482,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); diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 7703d94..2ecfa63 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using System; using System.Collections.Concurrent; using System.Collections.Generic; 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..d61df44 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,10 @@ - - - + + + + diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index 967be00..649a8ae 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -1,5 +1,6 @@ using System.Linq; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.Example.Unicast; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index 606a0b1..5dd3a8c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests @@ -11,17 +12,17 @@ namespace Reactive.Streams.TCK.Tests [TestFixture] public class SubscriberBlackboxVerificationTest : TCKVerificationSupport { - [Test] + [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; @@ -32,7 +33,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; @@ -43,7 +44,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; @@ -54,7 +55,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; @@ -65,7 +66,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; @@ -79,18 +80,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 => @@ -103,25 +104,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(), diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index f749bcb..e7dbc84 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -1,6 +1,7 @@ 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,7 +14,7 @@ namespace Reactive.Streams.TCK.Tests [TestFixture] public class SubscriberWhiteboxVerificationTest : TCKVerificationSupport { - [Test] + [SkippableFact] public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() { // this mostly verifies the probe is injected correctly @@ -34,11 +35,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 => @@ -59,7 +60,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 => @@ -81,7 +82,7 @@ public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComp } - [Test] + [SkippableFact] public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingRequest() { Func, ISubscriber> createSubscriber = probe => @@ -101,7 +102,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 => @@ -121,7 +122,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 => @@ -137,7 +138,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 => @@ -173,7 +174,7 @@ public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCall "But I thought it's cancelled!"); } - [Test] + [SkippableFact] public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -188,7 +189,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPreced "did not call `RegisterOnComplete()`"); } - [Test] + [SkippableFact] public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall_shouldPass_withNoopSubscriber() { Func, ISubscriber> createSubscriber = probe => @@ -203,7 +204,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPre "did not call `RegisterOnSubscribe`"); } - [Test] + [SkippableFact] public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -219,7 +220,7 @@ public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPreceding "Test Exception: Boom!"); } - [Test] + [SkippableFact] public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -235,7 +236,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 diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index a610fb2..9bbaabb 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK.Tests.Support diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index e1b1280..77040f7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index 94a360d..be045b7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs index 5b6281d..9c59240 100644 --- a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs +++ b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK @@ -52,6 +53,8 @@ protected IdentityProcessorVerification(TestEnvironment environment, long publis _processorBufferSize = processorBufferSize; _subscriberVerification = new IdentifierWhiteboxVerification(this); _publisherVerification = new IdentifierPublisherVerification(this, publisherReferenceGcTimeoutMillis); + + SetUp(); } private sealed class IdentifierPublisherVerification : PublisherVerification @@ -154,7 +157,6 @@ public override ISubscriber CreateSubscriber(WhiteboxSubscriberProbe probe ////////////////////// TEST ENV CLEANUP ///////////////////////////////////// - [SetUp] public void SetUp() { _publisherVerification.SetUp(); @@ -171,11 +173,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(); @@ -183,146 +185,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 => { @@ -419,7 +421,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); @@ -436,85 +438,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(); @@ -522,7 +524,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 4d3e1ca..f0765c6 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1,7 +1,9 @@ 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; @@ -31,6 +33,7 @@ protected PublisherVerification(TestEnvironment environment, long publisherRefer { _environment = environment; _publisherReferenceGcTimeoutMillis = publisherReferenceGcTimeoutMillis; + SetUp(); } /// @@ -113,12 +116,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 = @@ -134,7 +136,7 @@ public void Required_createPublisher1MustProduceAStreamOfExactly1Element() }); } - [Test] + [SkippableFact] public void Required_createPublisher3MustProduceAStreamOfExactly3Elements() { Func, ManualSubscriber, Option> requestNextElementOrEndOfStream = @@ -152,11 +154,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"); @@ -164,7 +166,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 => { @@ -190,7 +192,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; @@ -206,7 +208,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; @@ -332,7 +334,7 @@ public void OnComplete() } // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4 - [Test] + [SkippableFact] public void Optional_spec104_mustSignalOnErrorWhenFails() { try @@ -392,7 +394,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 => { @@ -405,7 +407,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 => { @@ -416,12 +418,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 => { @@ -435,22 +437,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 => { @@ -469,7 +471,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 => { @@ -521,7 +523,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 => { @@ -563,12 +565,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 => { @@ -592,7 +594,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 => { @@ -648,7 +650,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 - [Test] + [SkippableFact] public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront() => OptionalActivePublisherTest(3, false, publisher => { @@ -675,7 +677,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen }); // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 - [Test] + [SkippableFact] public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected() => OptionalActivePublisherTest(3, true, publisher => { @@ -704,7 +706,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen ///////////////////// 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 => { @@ -735,7 +737,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; @@ -832,17 +834,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 => { @@ -877,7 +879,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 => { @@ -895,7 +897,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 => { @@ -905,7 +907,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 => { @@ -916,7 +918,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 @@ -974,7 +976,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 => @@ -1007,7 +1009,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; @@ -1025,7 +1027,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; @@ -1052,7 +1054,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 => { diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 1f9e4da..36cf106 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 @@ CC0 1.0 Universal 1.0.3 Reactive Streams - net45 + net452;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 a093679..ad02a1b 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -1,7 +1,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 @@ -22,6 +23,8 @@ public abstract class SubscriberBlackboxVerification : WithHelperPublisher protected SubscriberBlackboxVerification(TestEnvironment environment) { Environment = environment; + + Setup(); } // USER API @@ -44,13 +47,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 => { @@ -63,12 +65,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 => { @@ -81,7 +83,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 => { @@ -124,12 +126,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 () @@ -166,12 +168,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 () @@ -179,12 +181,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 => { @@ -238,7 +240,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 => { @@ -258,7 +260,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 => { @@ -267,24 +269,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 => { @@ -306,7 +308,7 @@ 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 => { @@ -332,7 +334,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 => { @@ -368,37 +370,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? diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index 8146bbb..13dace1 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -1,7 +1,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 @@ -17,6 +18,7 @@ public abstract class SubscriberWhiteboxVerification : WithHelperPublisher protected SubscriberWhiteboxVerification(TestEnvironment environment) { _environment = environment; + SetUp(); } // USER API @@ -32,13 +34,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 => { @@ -66,7 +67,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 => { @@ -77,12 +78,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 => { @@ -128,7 +129,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 => { @@ -173,12 +174,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 => { @@ -214,18 +215,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 => { @@ -240,7 +241,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 => { @@ -252,7 +253,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 => { @@ -263,7 +264,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 => { @@ -278,7 +279,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 => { @@ -290,22 +291,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 => { @@ -325,7 +326,7 @@ 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 => { @@ -349,7 +350,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 => { @@ -371,12 +372,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 => { @@ -391,27 +392,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? diff --git a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index 4f9829f..d4b1933 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -2,7 +2,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 From 14ecb1d5373a40c77e704399679ef7f9874717d6 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 19:49:17 +0700 Subject: [PATCH 02/55] Replace IgnoreException with SkipException --- .../Support/TCKVerificationSupport.cs | 4 ++-- src/tck/Reactive.Streams.TCK/PublisherVerification.cs | 2 +- .../Reactive.Streams.TCK/SubscriberBlackboxVerification.cs | 2 +- .../Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index 9bbaabb..62fef60 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -42,7 +42,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 @@ -52,7 +52,7 @@ public void RequireTestSkip(Action throwingRun, string messagePart) { throwingRun(); } - catch (IgnoreException ignore) + catch (SkipException ignore) { if(ignore.Message.Contains(messagePart)) return; diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index f0765c6..82cfd5c 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -353,7 +353,7 @@ public void Optional_spec104_mustSignalOnErrorWhenFails() _environment.VerifyNoAsyncErrors(); }); } - catch (IgnoreException) + catch (SkipException) { throw; } diff --git a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index ad02a1b..d37fb55 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -314,7 +314,7 @@ public void Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenPa { 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; diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index 13dace1..414e1c6 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -332,7 +332,7 @@ public void Required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersA { 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; From e2c1ae3eb048dc2abccdb0845a8e16cbae2871fb Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 20:22:20 +0700 Subject: [PATCH 03/55] Replace `Assert.Ignore` with `TckAssert.Skip` and `Assert.Fail` with `TckAssert.Fail` --- .../Support/TCKVerificationSupport.cs | 2 +- .../Reactive.Streams.TCK/PublisherVerification.cs | 14 +++++++------- .../SubscriberBlackboxVerification.cs | 2 +- .../SubscriberWhiteboxVerification.cs | 2 +- src/tck/Reactive.Streams.TCK/TestEnvironment.cs | 15 +++++++-------- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index 62fef60..ac715c4 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -132,7 +132,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/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 82cfd5c..8fe3818 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1119,9 +1119,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); @@ -1139,9 +1139,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."; @@ -1181,7 +1181,7 @@ public void PotentiallyPendingTest(IPublisher publisher, Action if (publisher != null) run(publisher); else - Assert.Ignore(message); + TckAssert.Skip(message); } /// @@ -1191,7 +1191,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); @@ -1199,7 +1199,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/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index d37fb55..2312215 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -416,7 +416,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 414e1c6..bb078c5 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -456,7 +456,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/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index d4b1933..3f4e5fc 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -148,7 +148,7 @@ public void Flop(string message) { try { - Assert.Fail(message); + TckAssert.Fail(message); } catch (Exception ex) { @@ -172,7 +172,7 @@ public void Flop(Exception exception, string message) { try { - Assert.Fail(message, exception); + TckAssert.Fail(message, exception); } catch (Exception) { @@ -196,7 +196,7 @@ public void Flop(Exception exception) { try { - Assert.Fail(exception.Message, exception); + TckAssert.Fail(exception.Message, exception); } catch (Exception) { @@ -220,12 +220,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 @@ -304,11 +304,10 @@ 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); } } From 6e56e66d802353e2bcb8b4396bc553762e414d39 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:15:33 +0700 Subject: [PATCH 04/55] replace Assert functions to the equivalent version in Xunit --- .../AsyncSubscriberTest.cs | 2 +- .../IterablePublisherTest.cs | 3 ++- .../PublisherVerification.cs | 17 ++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 6435138..59b762c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -31,7 +31,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 7a22b01..fd2367f 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -16,7 +16,8 @@ public IterablePublisherTest() : base(new TestEnvironment()) 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/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 8fe3818..e0ee3de 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -644,8 +644,8 @@ 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"); }); @@ -671,9 +671,10 @@ 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 @@ -699,8 +700,10 @@ 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 ////////////////////////////////// From 56e9f3e151a018de48bcdf44a2e45f6c36e5a1d1 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:16:09 +0700 Subject: [PATCH 05/55] Add `Assert.Fail` and `Assert.Ignore` support --- .../Support/AssertionException.cs | 47 +++++++++ .../Reactive.Streams.TCK/Support/TckAssert.cs | 95 +++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 src/tck/Reactive.Streams.TCK/Support/AssertionException.cs create mode 100644 src/tck/Reactive.Streams.TCK/Support/TckAssert.cs 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 + } +} From 08db99078afab02828aa69f55d357164e87315c3 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:23:00 +0700 Subject: [PATCH 06/55] Remove TextFixtureAttribute --- .../AsyncSubscriberTest.cs | 1 - .../IterablePublisherTest.cs | 1 - .../SyncSubscriberTest.cs | 1 - .../SyncSubscriberWhiteboxTest.cs | 4 +- .../UnboundedIntegerIncrementPublisherTest.cs | 1 - .../IdentityProcessorVerificationTest.cs | 2 - .../PublisherVerificationTest.cs | 2 - .../RangePublisherTest.cs | 50 +++++++++---------- .../SingleElementPublisherTest.cs | 1 - .../SubscriberBlackboxVerificationTest.cs | 22 -------- .../SubscriberWhiteboxVerificationTest.cs | 18 ------- .../SyncTriggeredDemandSubscriberTest.cs | 1 - ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 1 - 13 files changed, 26 insertions(+), 79 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 59b762c..2c91c77 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class AsyncSubscriberTest : SubscriberBlackboxVerification { public AsyncSubscriberTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index fd2367f..f3b9c6c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class IterablePublisherTest : PublisherVerification { public IterablePublisherTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index 9a9bc40..b69d903 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class SyncSubscriberTest : SubscriberBlackboxVerification { public SyncSubscriberTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index 45d76c1..32815ac 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -5,10 +5,9 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class ValueTypeSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification { - public ValueTypeSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) + public ValueTypeSyncSubscriberWhiteboxTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } @@ -68,7 +67,6 @@ public override void OnComplete() } } - [TestFixture] public class NullableSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification { public NullableSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 38a7e43..722d12b 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class UnboundedIntegerIncrementPublisherTest : PublisherVerification { public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index 4e59f32..bcf6296 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -22,7 +22,6 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo }, "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 { /// @@ -109,7 +108,6 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo }, "Did not receive expected error on downstream within " + DefaultTimeoutMilliseconds); } - [TestFixture(Ignore = "Helper verification for single test")] private sealed class Spec104IgnoreVerification : IdentityProcessorVerification { /// diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index d0da450..c21d8f5 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -160,7 +160,6 @@ public void Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete_shou "Subscriber.OnComplete() called before Subscriber.OnSubscribe"); } - [TestFixture(Ignore = "Helper for single test")] private sealed class Spec105Verification : PublisherVerification { private readonly IPublisher _publisher; @@ -655,7 +654,6 @@ public void Subscribe(ISubscriber subscriber) })); } - [TestFixture(Ignore = "Helper for single test")] private sealed class SimpleVerification : PublisherVerification { private readonly IPublisher _publisher; diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 2ecfa63..9780122 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -11,8 +11,8 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] - public class RangePublisherTest : PublisherVerification + //[TestFixture] + public class RangePublisherTest : PublisherVerification, IDisposable { static readonly ConcurrentDictionary stacks = new ConcurrentDictionary(); @@ -20,29 +20,6 @@ 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()) { @@ -189,5 +166,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/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index 649a8ae..d1edb39 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SingleElementPublisherTest : PublisherVerification { public SingleElementPublisherTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index 5dd3a8c..29cc8af 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -9,7 +9,6 @@ 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 { [SkippableFact] @@ -137,15 +136,8 @@ public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParameter private SubscriberBlackboxVerification NoopSubscriberVerification() => new NoopBlackboxVerification(new TestEnvironment()); - [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,15 +153,8 @@ public NoopBlackboxVerification(TestEnvironment environment) : base(environment) private SubscriberBlackboxVerification SimpleSubscriberVerification() => new SimpleBlackboxVerification(new TestEnvironment()); - [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,17 +180,10 @@ public override ISubscriber CreateSubscriber() private SubscriberBlackboxVerification CustomSubscriberVerification(ISubscriber subscriber) => new CustomBlackboxVerification(new TestEnvironment(), 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 e7dbc84..a67217f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -257,17 +257,8 @@ public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced_ private SubscriberWhiteboxVerification SimpleSubscriberVerification() => new SimpleWhiteboxVerification(new TestEnvironment()); - [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,19 +282,10 @@ public SimpleWhiteboxVerification(TestEnvironment environment) : base(environmen Func, ISubscriber> newSubscriber) => new CustomWhiteboxVerification(new TestEnvironment(), 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/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 77040f7..2d3e88c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -4,7 +4,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SyncTriggeredDemandSubscriberTest : SubscriberBlackboxVerification { public SyncTriggeredDemandSubscriberTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index be045b7..8f6da21 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SyncTriggeredDemandSubscriberWhiteboxTest : SubscriberWhiteboxVerification { public SyncTriggeredDemandSubscriberWhiteboxTest() : base(new TestEnvironment()) From ce6f42ecb2936840f3cab16b849426703f7bb360 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:05 +0700 Subject: [PATCH 07/55] Add ITestOutputHelper support --- .../AsyncSubscriberTest.cs | 2 +- .../IterablePublisherTest.cs | 2 +- .../SyncSubscriberTest.cs | 15 ++++++-- .../SyncSubscriberWhiteboxTest.cs | 2 +- .../UnboundedIntegerIncrementPublisherTest.cs | 2 +- .../EmptyLazyPublisherTest.cs | 2 +- .../IdentityProcessorVerificationTest.cs | 19 +++++++--- .../PublisherVerificationTest.cs | 28 ++++++++------ .../RangePublisherTest.cs | 3 +- .../SingleElementPublisherTest.cs | 2 +- .../SubscriberBlackboxVerificationTest.cs | 13 +++++-- .../SubscriberWhiteboxVerificationTest.cs | 12 ++++-- .../SyncTriggeredDemandSubscriberTest.cs | 2 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 2 +- .../Reactive.Streams.TCK/TestEnvironment.cs | 37 ++++++++++--------- 15 files changed, 89 insertions(+), 54 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 2c91c77..f674553 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class AsyncSubscriberTest : SubscriberBlackboxVerification { - public AsyncSubscriberTest() : base(new TestEnvironment()) + public AsyncSubscriberTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index f3b9c6c..77804a8 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class IterablePublisherTest : PublisherVerification { - public IterablePublisherTest() : base(new TestEnvironment()) + public IterablePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index b69d903..cac58cd 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -7,25 +7,34 @@ namespace Reactive.Streams.Example.Unicast.Tests { 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 32815ac..54c65f2 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -69,7 +69,7 @@ public override void OnComplete() 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 722d12b..6eab2f6 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class UnboundedIntegerIncrementPublisherTest : PublisherVerification { - public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment()) + public UnboundedIntegerIncrementPublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs index 53ce92f..5405913 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index bcf6296..f069039 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -12,12 +12,19 @@ public class IdentityProcessorVerificationTest : TCKVerificationSupport private static readonly long DefaultNoSignalsTimeoutMilliseconds = TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds(); + 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"); } @@ -27,7 +34,7 @@ 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)) { } @@ -103,7 +110,7 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo { RequireTestFailure(() => { - new Spec104WaitingVerification(NewTestEnvironment(), DefaultTimeoutMilliseconds) + new Spec104WaitingVerification(NewTestEnvironment(_output), DefaultTimeoutMilliseconds) .Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError(); }, "Did not receive expected error on downstream within " + DefaultTimeoutMilliseconds); } @@ -113,7 +120,7 @@ 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)) { } @@ -134,8 +141,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 c21d8f5..3a8d808 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -14,6 +14,13 @@ namespace Reactive.Streams.TCK.Tests /// public class PublisherVerificationTest : TCKVerificationSupport { + private readonly ITestOutputHelper _output; + + public PublisherVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements_shouldFailBy_ExpectingOnError() => RequireTestFailure(() => NoopPublisherVerification().Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements(), @@ -155,7 +162,7 @@ public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates_shou 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"); } @@ -167,7 +174,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) { } @@ -505,7 +512,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 // @@ -521,7 +528,7 @@ private PublisherVerification NoopPublisherVerification() subscriber.OnSubscribe(new LamdaSubscription()); }); - return new SimpleVerification(NewTestEnvironment(), publisher); + return new SimpleVerification(new TestEnvironment(_output), publisher); } /// @@ -537,21 +544,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 @@ -567,7 +574,7 @@ private PublisherVerification DemandIgnoringSynchronousPublisherVerificatio subscriber.OnNext((int)i); })); }); - return new SimpleVerification(new TestEnvironment(), publisher); + return new SimpleVerification(new TestEnvironment(_output), publisher); } /// @@ -583,7 +590,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 { @@ -662,7 +669,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) { @@ -675,6 +682,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 9780122..426fa87 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -20,8 +20,7 @@ public class RangePublisherTest : PublisherVerification, IDisposable static int id; - - public RangePublisherTest() : base(new TestEnvironment()) + public RangePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index d1edb39..c67eb51 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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 29cc8af..a1d376e 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -11,6 +11,13 @@ namespace Reactive.Streams.TCK.Tests /// public class SubscriberBlackboxVerificationTest : TCKVerificationSupport { + private readonly ITestOutputHelper _output; + + public SubscriberBlackboxVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() => RequireTestFailure( @@ -134,7 +141,7 @@ 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)); private sealed class NoopBlackboxVerification : SubscriberBlackboxVerification { @@ -151,7 +158,7 @@ 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)); private sealed class SimpleBlackboxVerification : SubscriberBlackboxVerification { @@ -178,7 +185,7 @@ 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); private sealed class CustomBlackboxVerification : SubscriberBlackboxVerification { diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index a67217f..efbd695 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -11,9 +11,15 @@ 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 { + private readonly ITestOutputHelper _output; + + public SubscriberWhiteboxVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() { @@ -255,7 +261,7 @@ 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)); private sealed class SimpleWhiteboxVerification : SubscriberWhiteboxVerification { @@ -280,7 +286,7 @@ public SimpleWhiteboxVerification(TestEnvironment environment) : base(environmen /// private SubscriberWhiteboxVerification CustomSubscriberVerification( Func, ISubscriber> newSubscriber) - => new CustomWhiteboxVerification(new TestEnvironment(), newSubscriber); + => new CustomWhiteboxVerification(new TestEnvironment(_output), newSubscriber); private sealed class CustomWhiteboxVerification : SubscriberWhiteboxVerification { diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 2d3e88c..23ea52b 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -6,7 +6,7 @@ namespace Reactive.Streams.TCK.Tests { 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 8f6da21..df5d9a4 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index 3f4e5fc..ff6b661 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -15,6 +15,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 @@ -24,12 +25,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; } /// @@ -39,8 +40,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) { } @@ -51,11 +55,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) { } @@ -65,8 +69,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) { } @@ -81,11 +88,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(); /// @@ -312,12 +314,11 @@ public void VerifyNoAsyncErrorsNoDelay() } /// - /// 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}"); } /// From 72e080b640993c78a900083c63385cb4d1a19ad6 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:42 +0700 Subject: [PATCH 08/55] Fix OptionalActivePublisherTest, it was eating all exceptions --- src/tck/Reactive.Streams.TCK/PublisherVerification.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index e0ee3de..398967c 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -6,8 +6,6 @@ using Xunit.Abstractions; using Reactive.Streams.TCK.Support; -//using Reactive.Streams.TCK.Support; - namespace Reactive.Streams.TCK { public abstract class PublisherVerification : IPublisherVerificationRules @@ -1157,10 +1155,12 @@ public void OptionalActivePublisherTest(long elements, bool completionSignalRequ { NotVerified(skipMessage + "Reason for skipping was: " + ex.Message); } + /* catch (Exception) { NotVerified(skipMessage); } + */ } public const string SkippingNoErrorPublisherAvailable = From d484a57331226ad3802d28072882da4cf3d44e19 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:59 +0700 Subject: [PATCH 09/55] Turn on netcoreapp3.1 testing --- .../Reactive.Streams.Example.Unicast.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0736f03..f0b48d9 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 - net461 + net461;netcoreapp3.1 win7-x64 From 1c4a538d486fa80387648fd851c963131fd2c7f0 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Sat, 22 Aug 2020 00:37:17 +0700 Subject: [PATCH 10/55] Update build script to dotnet 3.1.105 LTS, add RunTestsDotNet build args --- build.fsx | 126 +++++++++++++++++++++++++++++---------- build.ps1 | 25 ++------ src/Reactive.Streams.sln | 18 +++--- 3 files changed, 110 insertions(+), 59 deletions(-) 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 From d9b05e338cc0d82b9bc67fcc0bf0843aa4657eb2 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Mon, 17 May 2021 23:50:50 +0700 Subject: [PATCH 11/55] Update framework targets and package versions --- src/api/Reactive.Streams/Reactive.Streams.csproj | 2 +- .../Reactive.Streams.Example.Unicast.Tests.csproj | 5 ++++- .../Reactive.Streams.Example.Unicast.csproj | 2 +- .../Reactive.Streams.TCK.Tests.csproj | 5 ++++- src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index 10efc1c..a4ba3d3 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -6,7 +6,7 @@ MIT-0 1.0.3 Reactive Streams - netstandard2.0;net452 + netstandard2.0;net461 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ 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 f0b48d9..0806159 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 @@ -15,7 +15,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + 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 f7f1b36..cc2efe4 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 - netstandard2.0;net452 + netstandard2.0;net461 true 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 d61df44..bcab5ee 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 @@ -15,7 +15,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index b2dabfb..6748f93 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 - net452;netstandard2.0 + net461;netstandard2.0 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ From 3e2e02f50248de059bfdcb3c81a5737c6f4b4f71 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 19:44:51 +0700 Subject: [PATCH 12/55] Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact] Signed-off-by: Gregorius Soedharmo --- .gitignore | 3 +- .../Reactive.Streams/Reactive.Streams.csproj | 3 +- .../AsyncSubscriberTest.cs | 5 +- .../IterablePublisherTest.cs | 3 +- ...ctive.Streams.Example.Unicast.Tests.csproj | 9 +- .../SyncSubscriberTest.cs | 3 +- .../SyncSubscriberWhiteboxTest.cs | 3 +- .../UnboundedIntegerIncrementPublisherTest.cs | 3 +- .../Reactive.Streams.Example.Unicast.csproj | 6 +- src/tck/README.md | 10 +- .../EmptyLazyPublisherTest.cs | 4 +- ...tityProcessorVerificationDelegationTest.cs | 13 +- .../IdentityProcessorVerificationTest.cs | 7 +- .../PublisherVerificationTest.cs | 73 ++++----- .../RangePublisherTest.cs | 3 +- .../Reactive.Streams.TCK.Tests.csproj | 9 +- .../SingleElementPublisherTest.cs | 3 +- .../SubscriberBlackboxVerificationTest.cs | 31 ++-- .../SubscriberWhiteboxVerificationTest.cs | 29 ++-- .../Support/TCKVerificationSupport.cs | 3 +- .../SyncTriggeredDemandSubscriberTest.cs | 3 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 3 +- .../IdentityProcessorVerification.cs | 138 +++++++++--------- .../PublisherVerification.cs | 78 +++++----- .../Reactive.Streams.TCK.csproj | 6 +- .../SubscriberBlackboxVerification.cs | 56 +++---- .../SubscriberWhiteboxVerification.cs | 59 ++++---- .../Reactive.Streams.TCK/TestEnvironment.cs | 3 +- 28 files changed, 297 insertions(+), 272 deletions(-) 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/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index aad21f6..0f1fb51 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -6,11 +6,10 @@ CC0 1.0 Universal 1.0.3 Reactive Streams - netstandard1.0;net45 + netstandard2.0;net452 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 1fe3c62..6435138 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -1,6 +1,7 @@ using System; using System.Threading; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; using Reactive.Streams.TCK.Support; @@ -22,7 +23,7 @@ private sealed class Suscriber : AsyncSubscriber protected override bool WhenNext(int? element) => true; } - [Test] + [SkippableFact] public void TestAccumulation() { var i = new AtomicCounterLong(0); diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index a62e30c..7a22b01 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -1,7 +1,8 @@ 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 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..0736f03 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 win7-x64 @@ -12,9 +12,10 @@ - - - + + + + diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index 3567681..9a9bc40 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; namespace Reactive.Streams.Example.Unicast.Tests diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index b3b3df5..45d76c1 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; namespace Reactive.Streams.Example.Unicast.Tests diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 7d3bced..38a7e43 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -1,7 +1,8 @@ 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 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..f7f1b36 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;net452 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 7db2d31..53ce92f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -1,10 +1,10 @@ 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()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs index f2ef0c1..16a55f7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs @@ -3,7 +3,8 @@ using System.Linq; using System.Reflection; using System.Text; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; namespace Reactive.Streams.TCK.Tests { @@ -16,7 +17,7 @@ namespace Reactive.Streams.TCK.Tests /// public class IdentityProcessorVerificationDelegationTest { - [Test] + [SkippableFact] public void ShouldIncludeAllTestsFromPublisherVerification() { var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList(); @@ -25,7 +26,7 @@ public void ShouldIncludeAllTestsFromPublisherVerification() typeof(PublisherVerification<>), publisherTests); } - [Test] + [SkippableFact] public void ShouldIncludeAllTestsFromSubscriberVerification() { var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList(); @@ -42,7 +43,7 @@ private static void AssertSuiteDelegatedAllTests(Type delegatingFrom, IList delegate{targetClass.Name}.{targetTest}();"); Assert.True(TestsInclude(allTests, targetTest), message.ToString()); @@ -54,7 +55,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 52542ed..4e59f32 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests @@ -11,7 +12,7 @@ public class IdentityProcessorVerificationTest : TCKVerificationSupport private static readonly long DefaultNoSignalsTimeoutMilliseconds = TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds(); - [Test] + [SkippableFact] public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldBeIgnored() { RequireTestSkip(() => @@ -98,7 +99,7 @@ public Spec104WaitingVerification(TestEnvironment environment, long publisherRef public override IPublisher CreateFailedPublisher() => null; } - [Test] + [SkippableFact] public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldFailWhileWaitingForOnError() { RequireTestFailure(() => diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index 0fb7a2a..d0da450 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -1,7 +1,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; @@ -13,22 +14,22 @@ namespace Reactive.Streams.TCK.Tests /// public class PublisherVerificationTest : TCKVerificationSupport { - [Test] + [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()); @@ -94,7 +95,7 @@ public void Subscribe(ISubscriber subscriber) })); } - [Test] + [SkippableFact] public void Stochastic_spec103_mustSignalOnMethodsSequentially_shouldPass_forSynchronousPublisher() { var publisher = new LamdaPublisher(onSubscribe: subscriber => @@ -112,7 +113,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 => @@ -124,12 +125,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 => @@ -150,7 +151,7 @@ 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()); @@ -184,7 +185,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(); @@ -202,7 +203,7 @@ public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSigna } } - [Test] + [SkippableFact] public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled_shouldFailForPublisherWhichCompletesButKeepsServingData() { var publisher = new LamdaPublisher(onSubscribe: subscriber => @@ -228,7 +229,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 => { }); @@ -237,7 +238,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 => @@ -249,7 +250,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()); @@ -258,7 +259,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)); @@ -267,7 +268,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())); @@ -276,7 +277,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())); @@ -285,25 +286,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(); @@ -320,12 +321,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 => @@ -340,16 +341,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 => @@ -364,17 +365,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(); @@ -392,7 +393,7 @@ public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling } } - [Test] + [SkippableFact] public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber_shouldFailBy_keepingTheReferenceLongerThanNeeded() { ISubscriber sub; @@ -414,7 +415,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(); @@ -432,12 +433,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; @@ -459,7 +460,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; @@ -481,7 +482,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); diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 7703d94..2ecfa63 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using System; using System.Collections.Concurrent; using System.Collections.Generic; 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..d61df44 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,10 @@ - - - + + + + diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index 967be00..649a8ae 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -1,5 +1,6 @@ using System.Linq; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.Example.Unicast; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index 606a0b1..5dd3a8c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests @@ -11,17 +12,17 @@ namespace Reactive.Streams.TCK.Tests [TestFixture] public class SubscriberBlackboxVerificationTest : TCKVerificationSupport { - [Test] + [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; @@ -32,7 +33,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; @@ -43,7 +44,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; @@ -54,7 +55,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; @@ -65,7 +66,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; @@ -79,18 +80,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 => @@ -103,25 +104,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(), diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index f749bcb..e7dbc84 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -1,6 +1,7 @@ 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,7 +14,7 @@ namespace Reactive.Streams.TCK.Tests [TestFixture] public class SubscriberWhiteboxVerificationTest : TCKVerificationSupport { - [Test] + [SkippableFact] public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() { // this mostly verifies the probe is injected correctly @@ -34,11 +35,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 => @@ -59,7 +60,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 => @@ -81,7 +82,7 @@ public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComp } - [Test] + [SkippableFact] public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingRequest() { Func, ISubscriber> createSubscriber = probe => @@ -101,7 +102,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 => @@ -121,7 +122,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 => @@ -137,7 +138,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 => @@ -173,7 +174,7 @@ public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCall "But I thought it's cancelled!"); } - [Test] + [SkippableFact] public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -188,7 +189,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPreced "did not call `RegisterOnComplete()`"); } - [Test] + [SkippableFact] public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall_shouldPass_withNoopSubscriber() { Func, ISubscriber> createSubscriber = probe => @@ -203,7 +204,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPre "did not call `RegisterOnSubscribe`"); } - [Test] + [SkippableFact] public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -219,7 +220,7 @@ public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPreceding "Test Exception: Boom!"); } - [Test] + [SkippableFact] public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -235,7 +236,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 diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index a610fb2..9bbaabb 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK.Tests.Support diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index e1b1280..77040f7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index 94a360d..be045b7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs index 5b6281d..9c59240 100644 --- a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs +++ b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK @@ -52,6 +53,8 @@ protected IdentityProcessorVerification(TestEnvironment environment, long publis _processorBufferSize = processorBufferSize; _subscriberVerification = new IdentifierWhiteboxVerification(this); _publisherVerification = new IdentifierPublisherVerification(this, publisherReferenceGcTimeoutMillis); + + SetUp(); } private sealed class IdentifierPublisherVerification : PublisherVerification @@ -154,7 +157,6 @@ public override ISubscriber CreateSubscriber(WhiteboxSubscriberProbe probe ////////////////////// TEST ENV CLEANUP ///////////////////////////////////// - [SetUp] public void SetUp() { _publisherVerification.SetUp(); @@ -171,11 +173,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(); @@ -183,146 +185,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 => { @@ -419,7 +421,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); @@ -436,85 +438,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(); @@ -522,7 +524,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 4d3e1ca..f0765c6 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1,7 +1,9 @@ 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; @@ -31,6 +33,7 @@ protected PublisherVerification(TestEnvironment environment, long publisherRefer { _environment = environment; _publisherReferenceGcTimeoutMillis = publisherReferenceGcTimeoutMillis; + SetUp(); } /// @@ -113,12 +116,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 = @@ -134,7 +136,7 @@ public void Required_createPublisher1MustProduceAStreamOfExactly1Element() }); } - [Test] + [SkippableFact] public void Required_createPublisher3MustProduceAStreamOfExactly3Elements() { Func, ManualSubscriber, Option> requestNextElementOrEndOfStream = @@ -152,11 +154,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"); @@ -164,7 +166,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 => { @@ -190,7 +192,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; @@ -206,7 +208,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; @@ -332,7 +334,7 @@ public void OnComplete() } // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4 - [Test] + [SkippableFact] public void Optional_spec104_mustSignalOnErrorWhenFails() { try @@ -392,7 +394,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 => { @@ -405,7 +407,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 => { @@ -416,12 +418,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 => { @@ -435,22 +437,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 => { @@ -469,7 +471,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 => { @@ -521,7 +523,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 => { @@ -563,12 +565,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 => { @@ -592,7 +594,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 => { @@ -648,7 +650,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 - [Test] + [SkippableFact] public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront() => OptionalActivePublisherTest(3, false, publisher => { @@ -675,7 +677,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen }); // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 - [Test] + [SkippableFact] public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected() => OptionalActivePublisherTest(3, true, publisher => { @@ -704,7 +706,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen ///////////////////// 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 => { @@ -735,7 +737,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; @@ -832,17 +834,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 => { @@ -877,7 +879,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 => { @@ -895,7 +897,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 => { @@ -905,7 +907,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 => { @@ -916,7 +918,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 @@ -974,7 +976,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 => @@ -1007,7 +1009,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; @@ -1025,7 +1027,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; @@ -1052,7 +1054,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 => { diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 1f9e4da..36cf106 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 @@ CC0 1.0 Universal 1.0.3 Reactive Streams - net45 + net452;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 a093679..ad02a1b 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -1,7 +1,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 @@ -22,6 +23,8 @@ public abstract class SubscriberBlackboxVerification : WithHelperPublisher protected SubscriberBlackboxVerification(TestEnvironment environment) { Environment = environment; + + Setup(); } // USER API @@ -44,13 +47,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 => { @@ -63,12 +65,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 => { @@ -81,7 +83,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 => { @@ -124,12 +126,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 () @@ -166,12 +168,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 () @@ -179,12 +181,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 => { @@ -238,7 +240,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 => { @@ -258,7 +260,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 => { @@ -267,24 +269,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 => { @@ -306,7 +308,7 @@ 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 => { @@ -332,7 +334,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 => { @@ -368,37 +370,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? diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index 8146bbb..13dace1 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -1,7 +1,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 @@ -17,6 +18,7 @@ public abstract class SubscriberWhiteboxVerification : WithHelperPublisher protected SubscriberWhiteboxVerification(TestEnvironment environment) { _environment = environment; + SetUp(); } // USER API @@ -32,13 +34,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 => { @@ -66,7 +67,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 => { @@ -77,12 +78,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 => { @@ -128,7 +129,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 => { @@ -173,12 +174,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 => { @@ -214,18 +215,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 => { @@ -240,7 +241,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 => { @@ -252,7 +253,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 => { @@ -263,7 +264,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 => { @@ -278,7 +279,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 => { @@ -290,22 +291,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 => { @@ -325,7 +326,7 @@ 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 => { @@ -349,7 +350,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 => { @@ -371,12 +372,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 => { @@ -391,27 +392,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? diff --git a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index 4f9829f..d4b1933 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -2,7 +2,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 From 2c21b074a8afaf7fbde135da3ee5ea149a224a5c Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 19:49:17 +0700 Subject: [PATCH 13/55] Replace IgnoreException with SkipException Signed-off-by: Gregorius Soedharmo --- .../Support/TCKVerificationSupport.cs | 4 ++-- src/tck/Reactive.Streams.TCK/PublisherVerification.cs | 2 +- .../Reactive.Streams.TCK/SubscriberBlackboxVerification.cs | 2 +- .../Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index 9bbaabb..62fef60 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -42,7 +42,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 @@ -52,7 +52,7 @@ public void RequireTestSkip(Action throwingRun, string messagePart) { throwingRun(); } - catch (IgnoreException ignore) + catch (SkipException ignore) { if(ignore.Message.Contains(messagePart)) return; diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index f0765c6..82cfd5c 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -353,7 +353,7 @@ public void Optional_spec104_mustSignalOnErrorWhenFails() _environment.VerifyNoAsyncErrors(); }); } - catch (IgnoreException) + catch (SkipException) { throw; } diff --git a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index ad02a1b..d37fb55 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -314,7 +314,7 @@ public void Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenPa { 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; diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index 13dace1..414e1c6 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -332,7 +332,7 @@ public void Required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersA { 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; From 4c56cd046fc628994cfa44fd5f444a22fd697cbe Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 20:22:20 +0700 Subject: [PATCH 14/55] Replace `Assert.Ignore` with `TckAssert.Skip` and `Assert.Fail` with `TckAssert.Fail` Signed-off-by: Gregorius Soedharmo --- .../Support/TCKVerificationSupport.cs | 2 +- .../Reactive.Streams.TCK/PublisherVerification.cs | 14 +++++++------- .../SubscriberBlackboxVerification.cs | 2 +- .../SubscriberWhiteboxVerification.cs | 2 +- src/tck/Reactive.Streams.TCK/TestEnvironment.cs | 15 +++++++-------- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index 62fef60..ac715c4 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -132,7 +132,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/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 82cfd5c..8fe3818 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1119,9 +1119,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); @@ -1139,9 +1139,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."; @@ -1181,7 +1181,7 @@ public void PotentiallyPendingTest(IPublisher publisher, Action if (publisher != null) run(publisher); else - Assert.Ignore(message); + TckAssert.Skip(message); } /// @@ -1191,7 +1191,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); @@ -1199,7 +1199,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/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index d37fb55..2312215 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -416,7 +416,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 414e1c6..bb078c5 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -456,7 +456,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/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index d4b1933..3f4e5fc 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -148,7 +148,7 @@ public void Flop(string message) { try { - Assert.Fail(message); + TckAssert.Fail(message); } catch (Exception ex) { @@ -172,7 +172,7 @@ public void Flop(Exception exception, string message) { try { - Assert.Fail(message, exception); + TckAssert.Fail(message, exception); } catch (Exception) { @@ -196,7 +196,7 @@ public void Flop(Exception exception) { try { - Assert.Fail(exception.Message, exception); + TckAssert.Fail(exception.Message, exception); } catch (Exception) { @@ -220,12 +220,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 @@ -304,11 +304,10 @@ 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); } } From 9fa653e1763a4d694c98736df286995738213141 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:15:33 +0700 Subject: [PATCH 15/55] replace Assert functions to the equivalent version in Xunit Signed-off-by: Gregorius Soedharmo --- .../AsyncSubscriberTest.cs | 2 +- .../IterablePublisherTest.cs | 3 ++- .../PublisherVerification.cs | 17 ++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 6435138..59b762c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -31,7 +31,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 7a22b01..fd2367f 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -16,7 +16,8 @@ public IterablePublisherTest() : base(new TestEnvironment()) 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/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 8fe3818..e0ee3de 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -644,8 +644,8 @@ 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"); }); @@ -671,9 +671,10 @@ 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 @@ -699,8 +700,10 @@ 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 ////////////////////////////////// From a6cb65060cc47fae4582a9888aa4df70b303b98b Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:16:09 +0700 Subject: [PATCH 16/55] Add `Assert.Fail` and `Assert.Ignore` support Signed-off-by: Gregorius Soedharmo --- .../Support/AssertionException.cs | 47 +++++++++ .../Reactive.Streams.TCK/Support/TckAssert.cs | 95 +++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 src/tck/Reactive.Streams.TCK/Support/AssertionException.cs create mode 100644 src/tck/Reactive.Streams.TCK/Support/TckAssert.cs 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 + } +} From 5b50b7b1c1c28b1f3f89eca5cbca5914f09bbdb8 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:23:00 +0700 Subject: [PATCH 17/55] Remove TextFixtureAttribute Signed-off-by: Gregorius Soedharmo --- .../AsyncSubscriberTest.cs | 1 - .../IterablePublisherTest.cs | 1 - .../SyncSubscriberTest.cs | 1 - .../SyncSubscriberWhiteboxTest.cs | 4 +- .../UnboundedIntegerIncrementPublisherTest.cs | 1 - .../IdentityProcessorVerificationTest.cs | 2 - .../PublisherVerificationTest.cs | 2 - .../RangePublisherTest.cs | 50 +++++++++---------- .../SingleElementPublisherTest.cs | 1 - .../SubscriberBlackboxVerificationTest.cs | 22 -------- .../SubscriberWhiteboxVerificationTest.cs | 18 ------- .../SyncTriggeredDemandSubscriberTest.cs | 1 - ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 1 - 13 files changed, 26 insertions(+), 79 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 59b762c..2c91c77 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class AsyncSubscriberTest : SubscriberBlackboxVerification { public AsyncSubscriberTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index fd2367f..f3b9c6c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class IterablePublisherTest : PublisherVerification { public IterablePublisherTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index 9a9bc40..b69d903 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class SyncSubscriberTest : SubscriberBlackboxVerification { public SyncSubscriberTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index 45d76c1..32815ac 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -5,10 +5,9 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class ValueTypeSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification { - public ValueTypeSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) + public ValueTypeSyncSubscriberWhiteboxTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } @@ -68,7 +67,6 @@ public override void OnComplete() } } - [TestFixture] public class NullableSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification { public NullableSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 38a7e43..722d12b 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class UnboundedIntegerIncrementPublisherTest : PublisherVerification { public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index 4e59f32..bcf6296 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -22,7 +22,6 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo }, "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 { /// @@ -109,7 +108,6 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo }, "Did not receive expected error on downstream within " + DefaultTimeoutMilliseconds); } - [TestFixture(Ignore = "Helper verification for single test")] private sealed class Spec104IgnoreVerification : IdentityProcessorVerification { /// diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index d0da450..c21d8f5 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -160,7 +160,6 @@ public void Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete_shou "Subscriber.OnComplete() called before Subscriber.OnSubscribe"); } - [TestFixture(Ignore = "Helper for single test")] private sealed class Spec105Verification : PublisherVerification { private readonly IPublisher _publisher; @@ -655,7 +654,6 @@ public void Subscribe(ISubscriber subscriber) })); } - [TestFixture(Ignore = "Helper for single test")] private sealed class SimpleVerification : PublisherVerification { private readonly IPublisher _publisher; diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 2ecfa63..9780122 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -11,8 +11,8 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] - public class RangePublisherTest : PublisherVerification + //[TestFixture] + public class RangePublisherTest : PublisherVerification, IDisposable { static readonly ConcurrentDictionary stacks = new ConcurrentDictionary(); @@ -20,29 +20,6 @@ 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()) { @@ -189,5 +166,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/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index 649a8ae..d1edb39 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SingleElementPublisherTest : PublisherVerification { public SingleElementPublisherTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index 5dd3a8c..29cc8af 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -9,7 +9,6 @@ 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 { [SkippableFact] @@ -137,15 +136,8 @@ public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParameter private SubscriberBlackboxVerification NoopSubscriberVerification() => new NoopBlackboxVerification(new TestEnvironment()); - [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,15 +153,8 @@ public NoopBlackboxVerification(TestEnvironment environment) : base(environment) private SubscriberBlackboxVerification SimpleSubscriberVerification() => new SimpleBlackboxVerification(new TestEnvironment()); - [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,17 +180,10 @@ public override ISubscriber CreateSubscriber() private SubscriberBlackboxVerification CustomSubscriberVerification(ISubscriber subscriber) => new CustomBlackboxVerification(new TestEnvironment(), 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 e7dbc84..a67217f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -257,17 +257,8 @@ public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced_ private SubscriberWhiteboxVerification SimpleSubscriberVerification() => new SimpleWhiteboxVerification(new TestEnvironment()); - [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,19 +282,10 @@ public SimpleWhiteboxVerification(TestEnvironment environment) : base(environmen Func, ISubscriber> newSubscriber) => new CustomWhiteboxVerification(new TestEnvironment(), 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/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 77040f7..2d3e88c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -4,7 +4,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SyncTriggeredDemandSubscriberTest : SubscriberBlackboxVerification { public SyncTriggeredDemandSubscriberTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index be045b7..8f6da21 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SyncTriggeredDemandSubscriberWhiteboxTest : SubscriberWhiteboxVerification { public SyncTriggeredDemandSubscriberWhiteboxTest() : base(new TestEnvironment()) From ab53717f5621ccc1ae96ec26fd72f0751cef8407 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:05 +0700 Subject: [PATCH 18/55] Add ITestOutputHelper support Signed-off-by: Gregorius Soedharmo --- .../AsyncSubscriberTest.cs | 2 +- .../IterablePublisherTest.cs | 2 +- .../SyncSubscriberTest.cs | 15 ++++++-- .../SyncSubscriberWhiteboxTest.cs | 2 +- .../UnboundedIntegerIncrementPublisherTest.cs | 2 +- .../EmptyLazyPublisherTest.cs | 2 +- .../IdentityProcessorVerificationTest.cs | 19 +++++++--- .../PublisherVerificationTest.cs | 28 ++++++++------ .../RangePublisherTest.cs | 3 +- .../SingleElementPublisherTest.cs | 2 +- .../SubscriberBlackboxVerificationTest.cs | 13 +++++-- .../SubscriberWhiteboxVerificationTest.cs | 12 ++++-- .../SyncTriggeredDemandSubscriberTest.cs | 2 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 2 +- .../Reactive.Streams.TCK/TestEnvironment.cs | 37 ++++++++++--------- 15 files changed, 89 insertions(+), 54 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 2c91c77..f674553 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class AsyncSubscriberTest : SubscriberBlackboxVerification { - public AsyncSubscriberTest() : base(new TestEnvironment()) + public AsyncSubscriberTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index f3b9c6c..77804a8 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class IterablePublisherTest : PublisherVerification { - public IterablePublisherTest() : base(new TestEnvironment()) + public IterablePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index b69d903..cac58cd 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -7,25 +7,34 @@ namespace Reactive.Streams.Example.Unicast.Tests { 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 32815ac..54c65f2 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -69,7 +69,7 @@ public override void OnComplete() 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 722d12b..6eab2f6 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class UnboundedIntegerIncrementPublisherTest : PublisherVerification { - public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment()) + public UnboundedIntegerIncrementPublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs index 53ce92f..5405913 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index bcf6296..f069039 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -12,12 +12,19 @@ public class IdentityProcessorVerificationTest : TCKVerificationSupport private static readonly long DefaultNoSignalsTimeoutMilliseconds = TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds(); + 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"); } @@ -27,7 +34,7 @@ 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)) { } @@ -103,7 +110,7 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo { RequireTestFailure(() => { - new Spec104WaitingVerification(NewTestEnvironment(), DefaultTimeoutMilliseconds) + new Spec104WaitingVerification(NewTestEnvironment(_output), DefaultTimeoutMilliseconds) .Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError(); }, "Did not receive expected error on downstream within " + DefaultTimeoutMilliseconds); } @@ -113,7 +120,7 @@ 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)) { } @@ -134,8 +141,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 c21d8f5..3a8d808 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -14,6 +14,13 @@ namespace Reactive.Streams.TCK.Tests /// public class PublisherVerificationTest : TCKVerificationSupport { + private readonly ITestOutputHelper _output; + + public PublisherVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements_shouldFailBy_ExpectingOnError() => RequireTestFailure(() => NoopPublisherVerification().Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements(), @@ -155,7 +162,7 @@ public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates_shou 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"); } @@ -167,7 +174,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) { } @@ -505,7 +512,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 // @@ -521,7 +528,7 @@ private PublisherVerification NoopPublisherVerification() subscriber.OnSubscribe(new LamdaSubscription()); }); - return new SimpleVerification(NewTestEnvironment(), publisher); + return new SimpleVerification(new TestEnvironment(_output), publisher); } /// @@ -537,21 +544,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 @@ -567,7 +574,7 @@ private PublisherVerification DemandIgnoringSynchronousPublisherVerificatio subscriber.OnNext((int)i); })); }); - return new SimpleVerification(new TestEnvironment(), publisher); + return new SimpleVerification(new TestEnvironment(_output), publisher); } /// @@ -583,7 +590,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 { @@ -662,7 +669,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) { @@ -675,6 +682,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 9780122..426fa87 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -20,8 +20,7 @@ public class RangePublisherTest : PublisherVerification, IDisposable static int id; - - public RangePublisherTest() : base(new TestEnvironment()) + public RangePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index d1edb39..c67eb51 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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 29cc8af..a1d376e 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -11,6 +11,13 @@ namespace Reactive.Streams.TCK.Tests /// public class SubscriberBlackboxVerificationTest : TCKVerificationSupport { + private readonly ITestOutputHelper _output; + + public SubscriberBlackboxVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() => RequireTestFailure( @@ -134,7 +141,7 @@ 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)); private sealed class NoopBlackboxVerification : SubscriberBlackboxVerification { @@ -151,7 +158,7 @@ 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)); private sealed class SimpleBlackboxVerification : SubscriberBlackboxVerification { @@ -178,7 +185,7 @@ 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); private sealed class CustomBlackboxVerification : SubscriberBlackboxVerification { diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index a67217f..efbd695 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -11,9 +11,15 @@ 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 { + private readonly ITestOutputHelper _output; + + public SubscriberWhiteboxVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() { @@ -255,7 +261,7 @@ 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)); private sealed class SimpleWhiteboxVerification : SubscriberWhiteboxVerification { @@ -280,7 +286,7 @@ public SimpleWhiteboxVerification(TestEnvironment environment) : base(environmen /// private SubscriberWhiteboxVerification CustomSubscriberVerification( Func, ISubscriber> newSubscriber) - => new CustomWhiteboxVerification(new TestEnvironment(), newSubscriber); + => new CustomWhiteboxVerification(new TestEnvironment(_output), newSubscriber); private sealed class CustomWhiteboxVerification : SubscriberWhiteboxVerification { diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 2d3e88c..23ea52b 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -6,7 +6,7 @@ namespace Reactive.Streams.TCK.Tests { 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 8f6da21..df5d9a4 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index 3f4e5fc..ff6b661 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -15,6 +15,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 @@ -24,12 +25,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; } /// @@ -39,8 +40,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) { } @@ -51,11 +55,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) { } @@ -65,8 +69,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) { } @@ -81,11 +88,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(); /// @@ -312,12 +314,11 @@ public void VerifyNoAsyncErrorsNoDelay() } /// - /// 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}"); } /// From 49fd87e26d83aa1e473ab7132825da1736b3a6ce Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:42 +0700 Subject: [PATCH 19/55] Fix OptionalActivePublisherTest, it was eating all exceptions Signed-off-by: Gregorius Soedharmo --- src/tck/Reactive.Streams.TCK/PublisherVerification.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index e0ee3de..398967c 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -6,8 +6,6 @@ using Xunit.Abstractions; using Reactive.Streams.TCK.Support; -//using Reactive.Streams.TCK.Support; - namespace Reactive.Streams.TCK { public abstract class PublisherVerification : IPublisherVerificationRules @@ -1157,10 +1155,12 @@ public void OptionalActivePublisherTest(long elements, bool completionSignalRequ { NotVerified(skipMessage + "Reason for skipping was: " + ex.Message); } + /* catch (Exception) { NotVerified(skipMessage); } + */ } public const string SkippingNoErrorPublisherAvailable = From 044a695e1ad0a8e5c94b7dfaaab6d30ae8531b4c Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:59 +0700 Subject: [PATCH 20/55] Turn on netcoreapp3.1 testing Signed-off-by: Gregorius Soedharmo --- .../Reactive.Streams.Example.Unicast.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0736f03..f0b48d9 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 - net461 + net461;netcoreapp3.1 win7-x64 From 3a7436ad136da5688f04e19afb8e09e2546ab0ad Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Sat, 22 Aug 2020 00:37:17 +0700 Subject: [PATCH 21/55] Update build script to dotnet 3.1.105 LTS, add RunTestsDotNet build args Signed-off-by: Gregorius Soedharmo --- build.fsx | 126 +++++++++++++++++++++++++++++---------- build.ps1 | 25 ++------ src/Reactive.Streams.sln | 18 +++--- 3 files changed, 110 insertions(+), 59 deletions(-) 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 From 3a85e83eb93dba5d02ca17d51faea1485b7bac12 Mon Sep 17 00:00:00 2001 From: Marc Piechura Date: Thu, 20 Aug 2020 00:39:05 +0200 Subject: [PATCH 22/55] Added me to relicensing file Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Relicensing.txt b/Relicensing.txt index 5f77c00..eca5076 100644 --- a/Relicensing.txt +++ b/Relicensing.txt @@ -6,3 +6,4 @@ github name | Real Name, Email Address used for git commits, Company ---------------+---------------------------------------------------------------------------- viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. akarnokd | David Karnok, akarnokd@gmail.com +marcpiechura | Marc Piechura, piechura@gmx.net From de965e7113c2f3a405b2744de1122fc956ca6afa Mon Sep 17 00:00:00 2001 From: Chris Constantin Date: Wed, 19 Aug 2020 18:58:54 -0700 Subject: [PATCH 23/55] Signed relicensing doc Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Relicensing.txt b/Relicensing.txt index eca5076..a5344d8 100644 --- a/Relicensing.txt +++ b/Relicensing.txt @@ -7,3 +7,4 @@ github name | Real Name, Email Address used for git commits, Company viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. akarnokd | David Karnok, akarnokd@gmail.com marcpiechura | Marc Piechura, piechura@gmx.net +cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software Solutions Inc. From a5466f9f315bb69259c784e4bcd5fe69f3d51dd4 Mon Sep 17 00:00:00 2001 From: Alex Valuyskiy Date: Wed, 9 Sep 2020 22:15:20 +0300 Subject: [PATCH 24/55] Update Relicensing.txt Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Relicensing.txt b/Relicensing.txt index a5344d8..71d1ef0 100644 --- a/Relicensing.txt +++ b/Relicensing.txt @@ -8,3 +8,4 @@ viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. akarnokd | David Karnok, akarnokd@gmail.com marcpiechura | Marc Piechura, piechura@gmx.net cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software Solutions Inc. +alexvaluyskiy | Oleksii Valuiskyi, alex.valuiskyi@gmail.com From 1093ff00b521c79be6ca5e10f1c8fe36c72759e4 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Thu, 29 Oct 2020 11:05:23 +0100 Subject: [PATCH 25/55] Port NUnit to XUnit, update target frameworks to netstandard2.0 and net461, update nuget package versions Author: Gregorius Soedharmo --- CONTRIBUTING.md | 22 ++-- COPYING | 121 ------------------ CopyrightWaivers.txt | 25 ---- LICENSE | 11 +- README.md | 16 +-- src/SharedAssemblyInfo.cs | 2 +- src/api/Reactive.Streams/IProcessor.cs | 3 + src/api/Reactive.Streams/IPublisher.cs | 3 + src/api/Reactive.Streams/ISubscriber.cs | 5 +- src/api/Reactive.Streams/ISubscription.cs | 3 + .../Reactive.Streams/Reactive.Streams.csproj | 2 +- .../AsyncSubscriberTest.cs | 5 +- .../IterablePublisherTest.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../SyncSubscriberTest.cs | 5 +- .../SyncSubscriberWhiteboxTest.cs | 5 +- .../UnboundedIntegerIncrementPublisherTest.cs | 5 +- .../AsyncIterablePublisher.cs | 5 +- .../AsyncSubscriber.cs | 5 +- .../AtomicBoolean.cs | 5 +- .../IllegalStateException.cs | 5 +- .../InfiniteIncrementNumberPublisher.cs | 5 +- .../NumberIterablePublisher.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../SyncSubscriber.cs | 5 +- .../EmptyLazyPublisherTest.cs | 5 +- ...tityProcessorVerificationDelegationTest.cs | 5 +- .../IdentityProcessorVerificationTest.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../PublisherVerificationTest.cs | 5 +- .../RangePublisherTest.cs | 5 +- .../SingleElementPublisherTest.cs | 5 +- .../SubscriberBlackboxVerificationTest.cs | 5 +- .../SubscriberWhiteboxVerificationTest.cs | 5 +- .../Support/LamdaPublisher.cs | 5 +- .../Support/LamdaSubscriber.cs | 5 +- .../Support/LamdaSubscription.cs | 5 +- .../Support/SyncTriggeredDemandSubscriber.cs | 5 +- .../Support/TCKVerificationSupport.cs | 5 +- .../SyncTriggeredDemandSubscriberTest.cs | 5 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 5 +- .../IdentityProcessorVerification.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../PublisherVerification.cs | 5 +- .../Reactive.Streams.TCK.csproj | 2 +- .../Reactive.Streams.TCK.nuspec | 2 +- .../SubscriberBlackboxVerification.cs | 5 +- .../SubscriberWhiteboxVerification.cs | 5 +- .../Support/AtomicBoolean.cs | 5 +- .../Support/AtomicCounter.cs | 5 +- .../Support/AtomicCounterLong.cs | 5 +- .../Support/AtomicReference.cs | 5 +- .../Support/HelperPublisher.cs | 5 +- .../Support/IPublisherVerificationRules .cs | 5 +- .../ISubscriberBlackboxVerificationRules.cs | 5 +- .../ISubscriberWhiteboxVerificationRules.cs | 5 +- .../Support/IllegalStateException.cs | 5 +- .../Support/InfiniteHelperPublisher.cs | 5 +- .../Reactive.Streams.TCK/Support/Option.cs | 5 +- .../SubscriberBufferOverflowException.cs | 5 +- .../Support/TestException.cs | 5 +- .../Reactive.Streams.TCK/TestEnvironment.cs | 5 +- .../WithHelperPublisher.cs | 5 +- 63 files changed, 231 insertions(+), 236 deletions(-) delete mode 100644 COPYING delete mode 100644 CopyrightWaivers.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa61517..52380f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,6 @@ # Contributing to the Reactive Streams Project -The Reactive Streams project welcomes contributions from anybody who wants to participate in moving this initiative forward. All code or documentation that is contributed will have to be covered by a waiver of all copyrights and other rights as detailed by the LICENSE and COPYING files at each repository root, the rationale for this is that the APIs defined by this project shall be freely implementable and usable by everyone. - -## Copyright Statement - -The aforementioned waiver of copyrights and other rights is represented by the addition of a line to the file [CopyrightWaivers.txt](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/CopyrightWaivers.txt). For a pull request to be considered every contributor must have signed the copyright statement in this way; this may be included within that same pull request. +The Reactive Streams project welcomes contributions from anybody who wants to participate in moving this initiative forward. All code or documentation that is contributed will have to be covered by the **MIT No Attribution** (SPDX: MIT-0) license, the rationale for this is that the APIs defined by this project shall be freely implementable and usable by everyone. For more detail, see [LICENSE](https://github.com/reactive-streams/reactive-streams-jvm/blob/master/LICENSE). ## Gatekeepers @@ -28,16 +24,15 @@ Gatekeepers commit to the following: ## General Workflow -1. Make sure you have signed the Copyright Statement, see above. -2. Before starting to work on a change, make sure that: +1. Before starting to work on a change, make sure that: 1. There is a ticket for your work in the project's issue tracker. If not, create it first. It can help accelerating the pull request acceptance process if the change is agreed upon beforehand within the ticket, but in some cases it may be preferable to discuss the necessity of the change in consideration of a concrete proposal. 2. The ticket has been scheduled for the current milestone. -3. You should always perform your work in a Git feature branch within your own fork of the repository your are targeting (even if you should have push rights to the target repository). -4. When the change is completed you should open a [Pull Request](https://help.github.com/articles/using-pull-requests) on GitHub. -5. Anyone can comment on the pull request while it is open, and you are expected to answer questions or incorporate feedback. -6. Once at least two thirds of the gatekeepers have signaled their consent, the pull request is merged by one of the gatekeepers into the branch and repository it is targeting. Consent is signaled by commenting on the pull request with the text “LGTM”, and it suffices for one representative of a gatekeeper to signal consent for that gatekeeper to be counted towards the two thirds quorum. -7. It is not allowed to force-push to the branch on which the pull request is based. Replacing or adding to the commits on that branch will invalidate all previous consenting comments and consent needs to be re-established. -8. Before merging a branch that contains multiple commits, it is recommended that these are squashed into a single commit before performing the merge. To aid in verification that no new changes are introduced, a new pull request should be opened in this case, targeting the same branch and repository and containing just one commit which encompasses the full change set of the original pull request. +2. You should always perform your work in a Git feature branch within your own fork of the repository your are targeting (even if you should have push rights to the target repository). +3. When the change is completed you should open a [Pull Request](https://help.github.com/articles/using-pull-requests) on GitHub. +4. Anyone can comment on the pull request while it is open, and you are expected to answer questions or incorporate feedback. +5. Once at least two thirds of the gatekeepers have signaled their consent, the pull request is merged by one of the gatekeepers into the branch and repository it is targeting. Consent is signaled by commenting on the pull request with the text “LGTM”, and it suffices for one representative of a gatekeeper to signal consent for that gatekeeper to be counted towards the two thirds quorum. +6. It is not allowed to force-push to the branch on which the pull request is based. Replacing or adding to the commits on that branch will invalidate all previous consenting comments and consent needs to be re-established. +7. Before merging a branch that contains multiple commits, it is recommended that these are squashed into a single commit before performing the merge. To aid in verification that no new changes are introduced, a new pull request should be opened in this case, targeting the same branch and repository and containing just one commit which encompasses the full change set of the original pull request. ## Pull Request Requirements @@ -68,7 +63,6 @@ Example: * clarify how pull requests should look like * describe the acceptance process - * define the Copyright Statement signing process ## Performing Official Releases diff --git a/COPYING b/COPYING deleted file mode 100644 index 0e259d4..0000000 --- a/COPYING +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. diff --git a/CopyrightWaivers.txt b/CopyrightWaivers.txt deleted file mode 100644 index 8f28c68..0000000 --- a/CopyrightWaivers.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright Statement for Contributions to the Reactive Streams Project -===================================================================== - -I hereby represent that all present, past and future contributions I make to -the Reactive Streams project (which includes all repositories owned by the -“reactive-streams” github organization) are governed by the Creative Commons -Zero 1.0 Universal copyright statement, placing my contributions in the public -domain. This entails that to the extent possible under law I waive all -copyright and related or neighboring rights to the code or documents I -contribute. I also represent that I have the authority to perform the above -waiver with respect to the entirety of my contributions. - -The text of the copyright statement is included in the COPYING file at the root -of the reactive-streams repository at -https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/COPYING. - -Underwriting parties: - -github name | Real Name, Email Address used for git commits, Company ----------------+---------------------------------------------------------------------------- -cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software Solutions, Inc. -viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend, Inc. -Silv3rcircl3 | Marc Piechura, piechura@gmx.net, Pulmokard GmbH -alexvaluyskiy | Alex Valuyskiy, alex.valuiskyi@gmail.com -akarnokd | David Karnok, akarnokd@gmail.com diff --git a/LICENSE b/LICENSE index 696f2c0..1e141c1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,7 @@ -Licensed under Public Domain (CC0) +MIT No Attribution -To the extent possible under law, the person who associated CC0 with -this code has waived all copyright and related or neighboring -rights to this code. +Copyright 2014 Reactive Streams -You should have received a copy of the CC0 legalcode along with this -work. If not, see . +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 4f8d7b2..9964ee5 100644 --- a/README.md +++ b/README.md @@ -229,18 +229,4 @@ ISubscribers signaling a demand for one element after the reception of an elemen ## Legal -This project is a collaboration between engineers from Kaazing, Netflix, Pivotal, Red Hat, Twitter, Typesafe and many others. The code is offered to the Public Domain in order to allow free use by interested parties who want to create compatible implementations. For details see `COPYING`. - -

- - CC0 - -
- To the extent possible under law, - - Reactive Streams Special Interest Group - has waived all copyright and related or neighboring rights to - Reactive Streams .NET. - This work is published from: - United States. -

+This project is a collaboration between engineers from Kaazing, Lightbend, Netflix, Pivotal, Red Hat, Twitter and many others. This project is licensed under MIT No Attribution (SPDX: MIT-0). diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs index d7781d0..84d1f3a 100644 --- a/src/SharedAssemblyInfo.cs +++ b/src/SharedAssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Reflection; [assembly: AssemblyCompanyAttribute("Reactive Streams")] -[assembly: AssemblyCopyrightAttribute("CC0 1.0 Universal")] +[assembly: AssemblyCopyrightAttribute("MIT-0")] [assembly: AssemblyTrademarkAttribute("")] [assembly: AssemblyVersionAttribute("1.0.0.0")] [assembly: AssemblyFileVersionAttribute("1.0.0.0")] diff --git a/src/api/Reactive.Streams/IProcessor.cs b/src/api/Reactive.Streams/IProcessor.cs index c01bb38..901c2d2 100644 --- a/src/api/Reactive.Streams/IProcessor.cs +++ b/src/api/Reactive.Streams/IProcessor.cs @@ -1,3 +1,6 @@ +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ namespace Reactive.Streams { /// diff --git a/src/api/Reactive.Streams/IPublisher.cs b/src/api/Reactive.Streams/IPublisher.cs index 078dd91..41c7b12 100644 --- a/src/api/Reactive.Streams/IPublisher.cs +++ b/src/api/Reactive.Streams/IPublisher.cs @@ -1,3 +1,6 @@ +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ namespace Reactive.Streams { /// diff --git a/src/api/Reactive.Streams/ISubscriber.cs b/src/api/Reactive.Streams/ISubscriber.cs index dfe6bd4..289ee23 100644 --- a/src/api/Reactive.Streams/ISubscriber.cs +++ b/src/api/Reactive.Streams/ISubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ + using System; namespace Reactive.Streams { diff --git a/src/api/Reactive.Streams/ISubscription.cs b/src/api/Reactive.Streams/ISubscription.cs index 2400c76..392b594 100644 --- a/src/api/Reactive.Streams/ISubscription.cs +++ b/src/api/Reactive.Streams/ISubscription.cs @@ -1,3 +1,6 @@ +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ namespace Reactive.Streams { /// diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index 0f1fb51..10efc1c 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -3,7 +3,7 @@ Reactive.Streams Reactive Streams API - CC0 1.0 Universal + MIT-0 1.0.3 Reactive Streams netstandard2.0;net452 diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index f674553..dbfd078 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Threading; using Xunit; using Xunit.Abstractions; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index 77804a8..a2d97a9 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Xunit; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs index 0e760c9..f76b21a 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index cac58cd..087bdfe 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index 54c65f2..23df0ba 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 6eab2f6..e4da786 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Xunit; diff --git a/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs b/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs index 2564b2c..37d8fc3 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs b/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs index 41d7110..6c3ec77 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Concurrent; using System.Threading.Tasks; diff --git a/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs b/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs index f721e60..85b88a7 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.Example.Unicast { diff --git a/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs b/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs index 1de87bd..1ec291c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.Example.Unicast { diff --git a/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs b/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs index 6bbdd11..e825109 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs @@ -1,4 +1,7 @@ -using System.Collections; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Collections; using System.Collections.Generic; namespace Reactive.Streams.Example.Unicast diff --git a/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs b/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs index a237408..aedbfad 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs @@ -1,4 +1,7 @@ -using System.Linq; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Linq; namespace Reactive.Streams.Example.Unicast { diff --git a/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs b/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs index 9367989..4bad06d 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden diff --git a/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs b/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs index b5ac19a..710a649 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.Example.Unicast { diff --git a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs index 5405913..68b7f92 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -1,4 +1,7 @@ -using System.Linq; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System.Linq; using Xunit; using Xunit.Abstractions; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs index 16a55f7..d724f11 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index f069039..d53b911 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs b/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs index e0bab10..2f364b2 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index 3a8d808..e9fa67f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Threading; using System.Threading.Tasks; using Xunit; diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 426fa87..cf5d416 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -1,4 +1,7 @@ -using Xunit; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using Xunit; using Xunit.Abstractions; using System; using System.Collections.Concurrent; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index c67eb51..0862005 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -1,4 +1,7 @@ -using System.Linq; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System.Linq; using Xunit; using Xunit.Abstractions; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index a1d376e..b777b4b 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index efbd695..e079c3c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Runtime.CompilerServices; using Xunit; using Xunit.Abstractions; diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs index 32b7d2b..354e9b2 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Tests.Support { diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs index 6daa2dc..dc30c64 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Runtime.CompilerServices; namespace Reactive.Streams.TCK.Tests.Support diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs index de46a57..c94c113 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Tests.Support { diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs index 23dcc40..b30cfa8 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK.Tests.Support diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index ac715c4..28986e0 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 23ea52b..0e7dd7c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -1,4 +1,7 @@ -using Xunit; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index df5d9a4..9b00c1c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs index 9c59240..1cd0366 100644 --- a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs +++ b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Generic; using Xunit; using Xunit.Abstractions; diff --git a/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs b/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs index 09d6cae..a0e01b3 100644 --- a/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs +++ b/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 398967c..3e0e3db 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Generic; using System.Threading; using FluentAssertions; diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 36cf106..b2dabfb 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj @@ -3,7 +3,7 @@ Reactive.Streams.TCK Reactive Streams Technology Compatibility Kit - CC0 1.0 Universal + MIT-0 1.0.3 Reactive Streams net452;netstandard2.0 diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec index 80146ca..611f4ca 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec @@ -9,7 +9,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ https://github.com/reactive-streams/reactive-streams-dotnet Reactive Streams Technology Compatibility Kit - CC0 1.0 Universal + MIT-0 reactive stream diff --git a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index 2312215..05ca09b 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Diagnostics; using System.Linq; using Xunit; diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index bb078c5..ce8cc72 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Diagnostics; using System.Linq; using Xunit; diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs index 6d8c8d7..91d1c37 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs index 5eb1b96..edc5911 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs index 7450795..ee5638b 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs index 93049f0..4dd3ab9 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs b/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs index 79f49e9..a1d670f 100644 --- a/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs +++ b/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs b/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs index 7a64136..b6a9a75 100644 --- a/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs +++ b/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs @@ -1,4 +1,7 @@ -namespace Reactive.Streams.TCK.Support +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +namespace Reactive.Streams.TCK.Support { /// /// Internal TCK use only. diff --git a/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs b/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs index e539827..f3d713f 100644 --- a/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs +++ b/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs @@ -1,4 +1,7 @@ -namespace Reactive.Streams.TCK.Support +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +namespace Reactive.Streams.TCK.Support { /// /// Internal TCK use only. diff --git a/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs b/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs index 1d95c28..a26d6d0 100644 --- a/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs +++ b/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs @@ -1,4 +1,7 @@ -namespace Reactive.Streams.TCK.Support +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +namespace Reactive.Streams.TCK.Support { /// /// Internal TCK use only. diff --git a/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs b/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs index 4229e8f..1dbda5a 100644 --- a/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs +++ b/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs b/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs index b66e7b4..e278ce4 100644 --- a/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs +++ b/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK/Support/Option.cs b/src/tck/Reactive.Streams.TCK/Support/Option.cs index 2aa6164..00e4b91 100644 --- a/src/tck/Reactive.Streams.TCK/Support/Option.cs +++ b/src/tck/Reactive.Streams.TCK/Support/Option.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Collections.Generic; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs b/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs index 4959db8..608ec5f 100644 --- a/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs +++ b/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/TestException.cs b/src/tck/Reactive.Streams.TCK/Support/TestException.cs index 61223de..7f073b2 100644 --- a/src/tck/Reactive.Streams.TCK/Support/TestException.cs +++ b/src/tck/Reactive.Streams.TCK/Support/TestException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index ff6b661..e1f8362 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading; diff --git a/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs b/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs index 5ae4f6d..15c6d1f 100644 --- a/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs +++ b/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs @@ -1,4 +1,7 @@ -using Reactive.Streams.TCK.Support; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK { From 635332b67dfc2d1284f7630ec48db1abbcaf7470 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Mon, 17 May 2021 23:50:50 +0700 Subject: [PATCH 26/55] Update framework targets and package versions Signed-off-by: Gregorius Soedharmo --- src/api/Reactive.Streams/Reactive.Streams.csproj | 2 +- .../Reactive.Streams.Example.Unicast.Tests.csproj | 5 ++++- .../Reactive.Streams.Example.Unicast.csproj | 2 +- .../Reactive.Streams.TCK.Tests.csproj | 5 ++++- src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index 10efc1c..a4ba3d3 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -6,7 +6,7 @@ MIT-0 1.0.3 Reactive Streams - netstandard2.0;net452 + netstandard2.0;net461 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ 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 f0b48d9..0806159 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 @@ -15,7 +15,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + 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 f7f1b36..cc2efe4 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 - netstandard2.0;net452 + netstandard2.0;net461 true 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 d61df44..bcab5ee 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 @@ -15,7 +15,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index b2dabfb..6748f93 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 - net452;netstandard2.0 + net461;netstandard2.0 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ From 94e485bc1e85ab8e535d4b4b548c15b31364f4d1 Mon Sep 17 00:00:00 2001 From: Alex Valuyskiy Date: Tue, 14 Mar 2017 21:23:31 +0200 Subject: [PATCH 27/55] Added copyright Signed-off-by: Gregorius Soedharmo --- CopyrightWaivers.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CopyrightWaivers.txt b/CopyrightWaivers.txt index f832725..87a465f 100644 --- a/CopyrightWaivers.txt +++ b/CopyrightWaivers.txt @@ -21,3 +21,4 @@ github name | Real Name, Email Address used for git commits, Company cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software Solutions, Inc. viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend, Inc. Silv3rcircl3 | Marc Piechura, piechura@gmx.net, Pulmokard GmbH +alexvaluyskiy | Alex Valuyskiy, alex.valuiskyi@gmail.com From abd4803886de48131d5e55344619f2f36a0050b8 Mon Sep 17 00:00:00 2001 From: David Karnok Date: Mon, 27 Mar 2017 18:17:51 +0200 Subject: [PATCH 28/55] Fix missing Cancel() in tests that don't consume the entire source (#32) Signed-off-by: Gregorius Soedharmo --- .../RangePublisherTest.cs | 192 ++++++++++++++++++ .../PublisherVerification.cs | 107 ++++++---- 2 files changed, 263 insertions(+), 36 deletions(-) create mode 100644 src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs new file mode 100644 index 0000000..7703d94 --- /dev/null +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -0,0 +1,192 @@ +using NUnit.Framework; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Reactive.Streams.TCK.Tests +{ + [TestFixture] + public class RangePublisherTest : PublisherVerification + { + static readonly ConcurrentDictionary stacks = new ConcurrentDictionary(); + + static readonly ConcurrentDictionary states = new ConcurrentDictionary(); + + 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 override IPublisher CreatePublisher(long elements) + { + return new RangePublisher(1, elements); + } + + public override IPublisher CreateFailedPublisher() + { + return null; + } + + internal sealed class RangePublisher : IPublisher + { + + readonly string stacktrace; + + readonly long start; + + readonly long count; + + internal RangePublisher(long start, long count) + { + this.stacktrace = Environment.StackTrace; + this.start = start; + this.count = count; + } + + public void Subscribe(ISubscriber s) + { + if (s == null) + { + throw new ArgumentNullException(); + } + + int ids = Interlocked.Increment(ref id); + + RangeSubscription parent = new RangeSubscription(s, ids, start, start + count); + stacks.AddOrUpdate(ids, (a) => stacktrace, (a, b) => stacktrace); + states.AddOrUpdate(ids, (a) => false, (a, b) => false); + s.OnSubscribe(parent); + } + + sealed class RangeSubscription : ISubscription + { + + readonly ISubscriber actual; + + readonly int ids; + + readonly long end; + + long index; + + volatile bool cancelled; + + long requested; + + internal RangeSubscription(ISubscriber actual, int ids, long start, long end) + { + this.actual = actual; + this.ids = ids; + this.index = start; + this.end = end; + } + + + public void Request(long n) + { + if (!cancelled) + { + if (n <= 0L) + { + cancelled = true; + states[ids] = true; + actual.OnError(new ArgumentException("§3.9 violated")); + return; + } + + for (;;) + { + long r = Volatile.Read(ref requested); + long u = r + n; + if (u < 0L) + { + u = long.MaxValue; + } + if (Interlocked.CompareExchange(ref requested, u, r) == r) + { + if (r == 0) + { + break; + } + return; + } + } + + long idx = index; + long f = end; + + for (;;) + { + long e = 0; + while (e != n && idx != f) + { + if (cancelled) + { + return; + } + + actual.OnNext((int)idx); + + idx++; + e++; + } + + if (idx == f) + { + if (!cancelled) + { + states[ids] = true; + actual.OnComplete(); + } + return; + } + + index = idx; + n = Interlocked.Add(ref requested, -n); + if (n == 0) + { + break; + } + } + } + } + + public void Cancel() + { + cancelled = true; + states[ids] = true; + } + } + } + } +} diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 301481d..4d3e1ca 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -52,7 +52,7 @@ public static long EnvironmentPublisherReferenceGcTimeoutMilliseconds() { var environmentMilliseconds = Environment.GetEnvironmentVariable(PublisherReferenceGcTimeoutMillisecondsEnvironment); - if(environmentMilliseconds == null) + if (environmentMilliseconds == null) return DefaultPublisherReferenceGcTimeoutMilliseconds; try { @@ -169,18 +169,24 @@ public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfPr => ActivePublisherTest(5, false, publisher => { var subscriber = _environment.NewManualSubscriber(publisher); + try + { + subscriber.ExpectNone($"Publisher {publisher} produced value before the first `Request`: "); + subscriber.Request(1); + subscriber.NextElement($"Publisher {publisher} produced no element after first `Request`"); + subscriber.ExpectNone($"Publisher {publisher} produced unrequested: "); - subscriber.ExpectNone($"Publisher {publisher} produced value before the first `Request`: "); - subscriber.Request(1); - subscriber.NextElement($"Publisher {publisher} produced no element after first `Request`"); - subscriber.ExpectNone($"Publisher {publisher} produced unrequested: "); - - subscriber.Request(1); - subscriber.Request(2); - subscriber.NextElements(3, _environment.DefaultTimeoutMilliseconds, - $"Publisher {publisher} produced less than 3 elements after two respective `Request` calls"); + subscriber.Request(1); + subscriber.Request(2); + subscriber.NextElements(3, _environment.DefaultTimeoutMilliseconds, + $"Publisher {publisher} produced less than 3 elements after two respective `Request` calls"); - subscriber.ExpectNone($"Publisher {publisher} produced unrequested "); + subscriber.ExpectNone($"Publisher {publisher} produced unrequested "); + } + finally + { + subscriber.Cancel(); + } }); // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.2 @@ -430,7 +436,7 @@ public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSigna // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.7 [Test] - public void Untested_spec107_mustNotEmitFurtherSignalsOnceOnErrorHasBeenSignalled() + 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 @@ -468,25 +474,41 @@ public void Required_spec109_mustIssueOnSubscribeForNonNullSubscriber() => ActivePublisherTest(0, false, publisher => { var onSubscriberLatch = new Latch(_environment); - publisher.Subscribe(new Spec109Subscriber(onSubscriberLatch)); - onSubscriberLatch.ExpectClose("Should have received OnSubscribe"); - _environment.VerifyNoAsyncErrorsNoDelay(); + var subscriber = new Spec109Subscriber(onSubscriberLatch); + try + { + publisher.Subscribe(subscriber); + onSubscriberLatch.ExpectClose("Should have received OnSubscribe"); + _environment.VerifyNoAsyncErrorsNoDelay(); + } + finally + { + subscriber.Cancel(); + } }); private class Spec109Subscriber : ISubscriber { private readonly Latch _onSubscriberLatch; + ISubscription upstream; + public Spec109Subscriber(Latch onSubscriberLatch) { _onSubscriberLatch = onSubscriberLatch; } + public void Cancel() + { + Interlocked.Exchange(ref upstream, null)?.Cancel(); + } + public void OnNext(T element) => _onSubscriberLatch.AssertClosed("OnSubscribe should be called prior to OnNext always"); public void OnSubscribe(ISubscription subscription) { + Interlocked.Exchange(ref upstream, subscription); _onSubscriberLatch.AssertOpen("Only one OnSubscribe call expected"); _onSubscriberLatch.Close(); } @@ -500,7 +522,7 @@ public void OnComplete() // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.9 [Test] - public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe () + public void Required_spec109_mayRejectCallsToSubscribeIfPublisherIsUnableOrUnwillingToServeThemRejectionMustTriggerOnErrorAfterOnSubscribe() => WhenHasErrorPublisherTest(publisher => { var onErrorLatch = new Latch(_environment); @@ -542,7 +564,7 @@ public override void OnSubscribe(ISubscription subscription) // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.10 [Test] - public void Untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice() + public void Untested_spec110_rejectASubscriptionRequestIfTheSameSubscriberSubscribesTwice() => NotVerified(); // can we meaningfully test this? // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 @@ -552,13 +574,26 @@ public void Optional_spec111_maySupportMultiSubscribe() { var sub1 = _environment.NewManualSubscriber(publisher); var sub2 = _environment.NewManualSubscriber(publisher); - - _environment.VerifyNoAsyncErrors(); + try + { + _environment.VerifyNoAsyncErrors(); + } + finally + { + try + { + sub1.Cancel(); + } + finally + { + sub2.Cancel(); + } + } }); // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 [Test] - public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne () + public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingOneByOne() => OptionalActivePublisherTest(5, true, publisher => { var sub1 = _environment.NewManualSubscriber(publisher); @@ -595,7 +630,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen var x4 = sub1.NextElement($"Publisher {publisher} did not produce the requested 1 element on 1st subscriber"); sub1.RequestEndOfStream($"Publisher {publisher} did not complete the stream as expected on 1st subscriber"); - var r = new List {x1, x2}; + var r = new List { x1, x2 }; r.AddRange(x3); r.Add(x4); @@ -614,7 +649,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 [Test] - public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront () + public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront() => OptionalActivePublisherTest(3, false, publisher => { var sub1 = _environment.NewManualSubscriber(publisher); @@ -633,7 +668,7 @@ 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"); @@ -667,7 +702,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen }); ///////////////////// SUBSCRIPTION TESTS ////////////////////////////////// - + // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.2 [Test] public void Required_spec302_mustAllowSynchronousRequestCallsFromOnNextAndOnSubscribe() @@ -800,7 +835,7 @@ public override void OnError(Exception cause) [Test] 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] public void Untested_spec305_cancelMustNotSynchronouslyPerformHeavyCompuatation() @@ -834,13 +869,13 @@ public Spec306Subscriber(TestEnvironment environment) : base(environment) // In this test however it must keep the cancelled Subscription and keep issuing `request(long)` to it. public override void Cancel() { - if(Subscription.IsCompleted()) + if (Subscription.IsCompleted()) Subscription.Value.Cancel(); else Environment.Flop("Cannot cancel a subscription before having received it"); } } - + // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.7 [Test] public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsMustBeNops() @@ -858,7 +893,7 @@ public void Required_spec307_afterSubscriptionIsCancelledAdditionalCancelationsM subscriber.ExpectNone(); _environment.VerifyNoAsyncErrorsNoDelay(); }); - + // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.9 [Test] public void Required_spec309_requestZeroMustSignalIllegalArgumentException() @@ -868,7 +903,7 @@ public void Required_spec309_requestZeroMustSignalIllegalArgumentException() subscriber.Request(0); subscriber.ExpectErrorWithMessage("3.9"); // we do require implementations to mention the rule number at the very least }); - + // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.9 [Test] public void Required_spec309_requestNegativeNumberMustSignalIllegalArgumentException() @@ -964,13 +999,13 @@ public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferenc GC.Collect(); ManualSubscriber tmp; - if(reference.TryGetTarget(out tmp)) + if (reference.TryGetTarget(out tmp)) _environment.Flop($"Publisher {publisher} did not drop reference to test subscriber after subscription cancellation"); _environment.VerifyNoAsyncErrorsNoDelay(); }); } - + // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#3.17 [Test] public void Required_spec317_mustSupportAPendingElementCountUpToLongMaxValue() @@ -1068,7 +1103,7 @@ public override void OnNext(T element) } ///////////////////// ADDITIONAL "COROLLARY" TESTS //////////////////////// - + ///////////////////// TEST INFRASTRUCTURE ///////////////////////////////// /// @@ -1083,7 +1118,7 @@ public void ActivePublisherTest(long elements, bool completionSignalRequired, Ac { if (elements > MaxElementsFromPublisher) Assert.Ignore($"Uable to run this test as required elements nr : {elements} is higher than supported by given producer {MaxElementsFromPublisher}"); - if(completionSignalRequired && MaxElementsFromPublisher == long.MaxValue) + 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"); var publisher = CreatePublisher(elements); @@ -1101,14 +1136,14 @@ public void ActivePublisherTest(long elements, bool completionSignalRequired, Ac /// The actual test to run public void OptionalActivePublisherTest(long elements, bool completionSignalRequired, Action> run) { - if(elements > MaxElementsFromPublisher) + if (elements > MaxElementsFromPublisher) Assert.Ignore($"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"); var publisher = CreatePublisher(elements); var skipMessage = "Skipped because tested publisher does NOT implement this OPTIONAL requirement."; - + try { PotentiallyPendingTest(publisher, run); @@ -1153,7 +1188,7 @@ public void PotentiallyPendingTest(IPublisher publisher, Action /// public void StochasticTest(int n, Action body) { - if(SkipStochasticTests) + if (SkipStochasticTests) Assert.Ignore("Skipping @Stochastic test because `SkipStochasticTests` returned `true`!"); for (var i = 0; i < n; i++) From c0225ec353997fe6a30be3225f1389402252c8e7 Mon Sep 17 00:00:00 2001 From: David Karnok Date: Sat, 18 Mar 2017 22:42:41 +0100 Subject: [PATCH 29/55] Update CopyrightWaivers.txt Signed-off-by: Gregorius Soedharmo --- CopyrightWaivers.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CopyrightWaivers.txt b/CopyrightWaivers.txt index 87a465f..8f28c68 100644 --- a/CopyrightWaivers.txt +++ b/CopyrightWaivers.txt @@ -22,3 +22,4 @@ cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend, Inc. Silv3rcircl3 | Marc Piechura, piechura@gmx.net, Pulmokard GmbH alexvaluyskiy | Alex Valuyskiy, alex.valuiskyi@gmail.com +akarnokd | David Karnok, akarnokd@gmail.com From 83730c7c320f88f2ffb245e1fa60b2fc6116f04b Mon Sep 17 00:00:00 2001 From: Marc Piechura Date: Sat, 1 Apr 2017 22:43:12 +0200 Subject: [PATCH 30/55] =?UTF-8?q?Skip=20=C2=A72.13=20for=20value=20types?= =?UTF-8?q?=20(#34)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gregorius Soedharmo --- .../SyncSubscriberWhiteboxTest.cs | 67 ++++++++++++++++++- .../SubscriberBlackboxVerificationTest.cs | 6 ++ .../SubscriberBlackboxVerification.cs | 8 ++- .../SubscriberWhiteboxVerification.cs | 8 ++- 4 files changed, 81 insertions(+), 8 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index 845a444..b3b3df5 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -5,9 +5,72 @@ namespace Reactive.Streams.Example.Unicast.Tests { [TestFixture] - public class SyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification + public class ValueTypeSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification { - public SyncSubscriberWhiteboxTest() : base(new TestEnvironment()) + public ValueTypeSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) + { + } + + public override int CreateElement(int element) => element; + + public override ISubscriber CreateSubscriber(WhiteboxSubscriberProbe probe) => new Subscriber(probe); + + private sealed class Subscriber : SyncSubscriber + { + private readonly WhiteboxSubscriberProbe _probe; + + public Subscriber(WhiteboxSubscriberProbe probe) + { + _probe = probe; + } + + public override void OnSubscribe(ISubscription subscription) + { + base.OnSubscribe(subscription); + + _probe.RegisterOnSubscribe(new SubscriberPuppet(subscription)); + } + + private sealed class SubscriberPuppet : ISubscriberPuppet + { + private readonly ISubscription _subscription; + + public SubscriberPuppet(ISubscription subscription) + { + _subscription = subscription; + } + + public void TriggerRequest(long elements) => _subscription.Request(elements); + + public void SignalCancel() => _subscription.Cancel(); + } + + public override void OnNext(int element) + { + base.OnNext(element); + _probe.RegisterOnNext(element); + } + + protected override bool WhenNext(int element) => true; + + public override void OnError(Exception cause) + { + base.OnError(cause); + _probe.RegisterOnError(cause); + } + + public override void OnComplete() + { + base.OnComplete(); + _probe.RegisterOnComplete(); + } + } + } + + [TestFixture] + public class NullableSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification + { + public NullableSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) { } diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index 853fd42..606a0b1 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -115,6 +115,12 @@ public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParameter () => CustomSubscriberVerification(new LamdaSubscriber()).Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenParametersAreNull(), "OnNext(null) did not throw ArgumentNullException"); + [Test] + public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParametersAreNull_mustIgnoreSpecForValueType_onNext() + => RequireTestSkip( + () => SimpleSubscriberVerification().Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenParametersAreNull(), + "Can't verify behavior for value types"); + [Test] public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParametersAreNull_mustFailOnIgnoredNull_onError() => RequireTestFailure( diff --git a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index f918136..a093679 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -310,15 +310,17 @@ public void Required_spec213_blackbox_onSubscribe_mustThrowNullPointerExceptionW 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"); + var subscriber = CreateSubscriber(); var gotNpe = false; subscriber.OnSubscribe(new Spec213DummySubscription()); try { - // we can't use null here because we can't enforce a constsraint which supports Nullable - // default(T) will return null for all reference types as well as Nullable - subscriber.OnNext(default(T)); + subscriber.OnNext(element); } catch (ArgumentNullException) { diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index 5eb1d7c..8146bbb 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -329,13 +329,15 @@ public void Required_spec213_onSubscribe_mustThrowNullPointerExceptionWhenParame 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"); + var subscriber = stage.Sub; var gotNpe = false; try { - // we can't use null here because we can't enforce a constsraint which supports Nullable - // default(T) will return null for all reference types as well as Nullable - subscriber.OnNext(default(T)); + subscriber.OnNext(element); } catch (ArgumentNullException) { From d45bfa57f0eedef92df982faeae2eb1a9f6e6316 Mon Sep 17 00:00:00 2001 From: Marc Piechura Date: Sat, 1 Apr 2017 23:05:40 +0200 Subject: [PATCH 31/55] fail if timeout is reached Signed-off-by: Gregorius Soedharmo --- src/tck/Reactive.Streams.TCK/TestEnvironment.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index 65bcca7..4f9829f 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -861,6 +861,9 @@ public List NextN(long elements, long timeoutMilliseconds, string errorMessag { var remainingMilliseconds = (long)(deadline - DateTime.Now).TotalMilliseconds; + if (remainingMilliseconds < 0) + return _environment.FlopAndFail>($"{errorMessage} within {timeoutMilliseconds} ms"); + result.Add(Next(remainingMilliseconds, errorMessage)); remaining--; } From 2b34b05e31999bc96beeca64ac76f6d0f9458082 Mon Sep 17 00:00:00 2001 From: Marc Piechura Date: Wed, 5 Apr 2017 21:38:40 +0200 Subject: [PATCH 32/55] 1.0.0 stable release (#28) Signed-off-by: Gregorius Soedharmo --- RELEASE_NOTES.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 49fbd0c..c155eaa 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,8 +1,20 @@ -#### 1.0.0-RC1 - 04.07.2016 +#### 1.0.0 - 05.04.2017 Reactive.Streams - - Support for PCL Profile7 - - Removed non-generic IPublisher and ISubscriber interfaces. + - Stable release + - Support for .Net Standard 1.0 + +Reactive.Streams.TCK + - Stable release + - Fix missing Cancel() in tests that don't consume the entire source #32 + - Skip §2.13 for value types #34 + - Fail NextN with the correct error message if timeout is reached #36 + +#### 1.0.0-RC1 - 04.07.2016 + +Reactive.Streams + - Support for PCL Profile7 + - Removed non-generic IPublisher and ISubscriber interfaces. Reactive.Streams.TCK - - Initial release \ No newline at end of file + - Initial release From 36ebf210923a797d1269ca4cc79534d8b4ec7bdc Mon Sep 17 00:00:00 2001 From: Marc Piechura Date: Fri, 7 Apr 2017 23:17:56 +0200 Subject: [PATCH 33/55] bump version Signed-off-by: Gregorius Soedharmo --- RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index c155eaa..92b2bb7 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,4 +1,4 @@ -#### 1.0.0 - 05.04.2017 +#### 1.0.2 - 07.04.2017 Reactive.Streams - Stable release From 5d687fca454b52f8bc98f51dcb7f2b98e4dddef3 Mon Sep 17 00:00:00 2001 From: David Karnok Date: Wed, 5 Apr 2017 13:24:55 +0200 Subject: [PATCH 34/55] Add the 'I' prefix to component names Signed-off-by: Gregorius Soedharmo --- README.md | 128 +++++++++++++++++++++++++++--------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 9789566..4f8d7b2 100644 --- a/README.md +++ b/README.md @@ -39,21 +39,21 @@ Implementations are free to implement additional features not covered by the spe The API consists of the following components that are required to be provided by Reactive Stream implementations: -1. Publisher -2. Subscriber -3. Subscription -4. Processor +1. IPublisher +2. ISubscriber +3. ISubscription +4. IProcessor -A *Publisher* is a provider of a potentially unbounded number of sequenced elements, publishing them according to the demand received from its Subscriber(s). +An *IPublisher* is a provider of a potentially unbounded number of sequenced elements, publishing them according to the demand received from its ISubscriber(s). -In response to a call to `Publisher.Subscribe(Subscriber)` the possible invocation sequences for methods on the `Subscriber` are given by the following protocol: +In response to a call to `IPublisher.Subscribe(ISubscriber)` the possible invocation sequences for methods on the `ISubscriber` are given by the following protocol: ``` onSubscribe onNext* (onError | onComplete)? ``` This means that `onSubscribe` is always signalled, -followed by a possibly unbounded number of `onNext` signals (as requested by `Subscriber`) followed by an `onError` signal if there is a failure, or an `onComplete` signal when no more elements are available—all as long as the `Subscription` is not cancelled. +followed by a possibly unbounded number of `onNext` signals (as requested by `ISubscriber`) followed by an `onError` signal if there is a failure, or an `onComplete` signal when no more elements are available—all as long as the `ISubscription` is not cancelled. #### NOTES @@ -64,7 +64,7 @@ followed by a possibly unbounded number of `onNext` signals (as requested by `Su ### SPECIFICATION -#### 1. Publisher ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/IPublisher.cs)) +#### 1. IPublisher ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/IPublisher.cs)) ```c# public interface IPublisher { @@ -74,21 +74,21 @@ public interface IPublisher { | ID | Rule | | ------------------------- | ------------------------------------------------------------------------------------------------------ | -| 1 | The total number of `onNext` signals sent by a `Publisher` to a `Subscriber` MUST be less than or equal to the total number of elements requested by that `Subscriber`´s `Subscription` at all times. | -| 2 | A `Publisher` MAY signal less `onNext` than requested and terminate the `Subscription` by calling `OnComplete` or `OnError`. | -| 3 | `onSubscribe`, `onNext`, `onError` and `onComplete` signaled to a `Subscriber` MUST be signaled sequentially (no concurrent notifications). | -| 4 | If a `Publisher` fails it MUST signal an `onError`. | -| 5 | If a `Publisher` terminates successfully (finite stream) it MUST signal an `onComplete`. | -| 6 | If a `Publisher` signals either `onError` or `onComplete` on a `Subscriber`, that `Subscriber`’s `Subscription` MUST be considered cancelled. | +| 1 | The total number of `onNext` signals sent by an `IPublisher` to an `ISubscriber` MUST be less than or equal to the total number of elements requested by that `ISubscriber`´s `ISubscription` at all times. | +| 2 | An `IPublisher` MAY signal less `onNext` than requested and terminate the `ISubscription` by calling `OnComplete` or `OnError`. | +| 3 | `onSubscribe`, `onNext`, `onError` and `onComplete` signaled to an `ISubscriber` MUST be signaled sequentially (no concurrent notifications). | +| 4 | If an `IPublisher` fails it MUST signal an `onError`. | +| 5 | If an `IPublisher` terminates successfully (finite stream) it MUST signal an `onComplete`. | +| 6 | If an `IPublisher` signals either `onError` or `onComplete` on an `ISubscriber`, that `ISubscriber`’s `ISubscription` MUST be considered cancelled. | | 7 | Once a terminal state has been signaled (`onError`, `onComplete`) it is REQUIRED that no further signals occur. | -| 8 | If a `Subscription` is cancelled its `Subscriber` MUST eventually stop being signaled. | -| 9 | `Publisher.Subscribe` MUST call `OnSubscribe` on the provided `Subscriber` prior to any other signals to that `Subscriber` and MUST return normally, except when the provided `Subscriber` is `null` in which case it MUST throw a `System.ArgumentNullException` to the caller, for all other situations [[1]](#footnote-1-1) the only legal way to signal failure (or reject the `Subscriber`) is by calling `OnError` (after calling `OnSubscribe`). | -| 10 | `Publisher.Subscribe` MAY be called as many times as wanted but MUST be with a different `Subscriber` each time [see [2.12](#2.12)]. | -| 11 | A `Publisher` MAY support multiple `Subscriber`s and decides whether each `Subscription` is unicast or multicast. | +| 8 | If an `ISubscription` is cancelled its `ISubscriber` MUST eventually stop being signaled. | +| 9 | `IPublisher.Subscribe` MUST call `OnSubscribe` on the provided `ISubscriber` prior to any other signals to that `ISubscriber` and MUST return normally, except when the provided `ISubscriber` is `null` in which case it MUST throw a `System.ArgumentNullException` to the caller, for all other situations [[1]](#footnote-1-1) the only legal way to signal failure (or reject the `ISubscriber`) is by calling `OnError` (after calling `OnSubscribe`). | +| 10 | `IPublisher.Subscribe` MAY be called as many times as wanted but MUST be with a different `ISubscriber` each time [see [2.12](#2.12)]. | +| 11 | An `IPublisher` MAY support multiple `ISubscriber`s and decides whether each `ISubscription` is unicast or multicast. | -[1] : A stateful Publisher can be overwhelmed, bounded by a finite number of underlying resources, exhausted, shut-down or in a failed state. +[1] : A stateful IPublisher can be overwhelmed, bounded by a finite number of underlying resources, exhausted, shut-down or in a failed state. -#### 2. Subscriber ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/ISubscriber.cs)) +#### 2. ISubscriber ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/ISubscriber.cs)) ```c# public interface ISubscriber { @@ -101,23 +101,23 @@ public interface ISubscriber { | ID | Rule | | ------------------------- | ------------------------------------------------------------------------------------------------------ | -| 1 | A `Subscriber` MUST signal demand via `Subscription.Request(long n)` to receive `onNext` signals. | -| 2 | If a `Subscriber` suspects that its processing of signals will negatively impact its `Publisher`'s responsivity, it is RECOMMENDED that it asynchronously dispatches its signals. | -| 3 | `Subscriber.OnComplete()` and `Subscriber.OnError(Exception cause)` MUST NOT call any methods on the `Subscription` or the `Publisher`. | -| 4 | `Subscriber.OnComplete()` and `Subscriber.OnError(Exception cause)` MUST consider the Subscription cancelled after having received the signal. | -| 5 | A `Subscriber` MUST call `Subscription.Cancel()` on the given `Subscription` after an `onSubscribe` signal if it already has an active `Subscription`. | -| 6 | A `Subscriber` MUST call `Subscription.Cancel()` if it is no longer valid to the `Publisher` without the `Publisher` having signaled `onError` or `onComplete`. | -| 7 | A `Subscriber` MUST ensure that all calls on its `Subscription` take place from the same thread or provide for respective external synchronization. | -| 8 | A `Subscriber` MUST be prepared to receive one or more `onNext` signals after having called `Subscription.Cancel()` if there are still requested elements pending [see [3.12](#3.12)]. `Subscription.Cancel()` does not guarantee to perform the underlying cleaning operations immediately. | -| 9 | A `Subscriber` MUST be prepared to receive an `onComplete` signal with or without a preceding `Subscription.Request(long n)` call. | -| 10 | A `Subscriber` MUST be prepared to receive an `onError` signal with or without a preceding `Subscription.Request(long n)` call. | -| 11 | A `Subscriber` MUST make sure that all calls on its `OnXXX` methods happen-before [[1]](#footnote-2-1) the processing of the respective signals. I.e. the Subscriber must take care of properly publishing the signal to its processing logic. | -| 12 | `Subscriber.OnSubscribe` MUST be called at most once for a given `Subscriber` (based on object equality). | -| 13 | Calling `OnSubscribe`, `OnNext`, `OnError` or `OnComplete` MUST return normally except when any provided parameter is `null` in which case it MUST throw a `System.ArgumentNullException` to the caller, for all other situations the only legal way for a `Subscriber` to signal failure is by cancelling its `Subscription`. In the case that this rule is violated, any associated `Subscription` to the `Subscriber` MUST be considered as cancelled, and the caller MUST raise this error condition in a fashion that is adequate for the runtime environment. | +| 1 | An `ISubscriber` MUST signal demand via `ISubscription.Request(long n)` to receive `onNext` signals. | +| 2 | If an `ISubscriber` suspects that its processing of signals will negatively impact its `IPublisher`'s responsivity, it is RECOMMENDED that it asynchronously dispatches its signals. | +| 3 | `ISubscriber.OnComplete()` and `ISubscriber.OnError(Exception cause)` MUST NOT call any methods on the `ISubscription` or the `IPublisher`. | +| 4 | `ISubscriber.OnComplete()` and `ISubscriber.OnError(Exception cause)` MUST consider the ISubscription cancelled after having received the signal. | +| 5 | An `ISubscriber` MUST call `ISubscription.Cancel()` on the given `ISubscription` after an `onSubscribe` signal if it already has an active `ISubscription`. | +| 6 | An `ISubscriber` MUST call `ISubscription.Cancel()` if it is no longer valid to the `IPublisher` without the `IPublisher` having signaled `onError` or `onComplete`. | +| 7 | An `ISubscriber` MUST ensure that all calls on its `ISubscription` take place from the same thread or provide for respective external synchronization. | +| 8 | An `ISubscriber` MUST be prepared to receive one or more `onNext` signals after having called `ISubscription.Cancel()` if there are still requested elements pending [see [3.12](#3.12)]. `ISubscription.Cancel()` does not guarantee to perform the underlying cleaning operations immediately. | +| 9 | An `ISubscriber` MUST be prepared to receive an `onComplete` signal with or without a preceding `ISubscription.Request(long n)` call. | +| 10 | An `ISubscriber` MUST be prepared to receive an `onError` signal with or without a preceding `ISubscription.Request(long n)` call. | +| 11 | An `ISubscriber` MUST make sure that all calls on its `OnXXX` methods happen-before [[1]](#footnote-2-1) the processing of the respective signals. I.e. the ISubscriber must take care of properly publishing the signal to its processing logic. | +| 12 | `ISubscriber.OnSubscribe` MUST be called at most once for a given `ISubscriber` (based on object equality). | +| 13 | Calling `OnSubscribe`, `OnNext`, `OnError` or `OnComplete` MUST return normally except when any provided parameter is `null` in which case it MUST throw a `System.ArgumentNullException` to the caller, for all other situations the only legal way for an `ISubscriber` to signal failure is by cancelling its `ISubscription`. In the case that this rule is violated, any associated `ISubscription` to the `ISubscriber` MUST be considered as cancelled, and the caller MUST raise this error condition in a fashion that is adequate for the runtime environment. | [1] : See JMM definition of Happen-Before in section 17.4.5. on http://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html -#### 3. Subscription ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/ISubscription.cs)) +#### 3. ISubscription ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/ISubscription.cs)) ```c# public interface ISubscription { @@ -128,33 +128,33 @@ public interface ISubscription { | ID | Rule | | ------------------------- | ------------------------------------------------------------------------------------------------------ | -| 1 | `Subscription.Request` and `Subscription.Cancel` MUST only be called inside of its `Subscriber` context. A `Subscription` represents the unique relationship between a `Subscriber` and a `Publisher` [see [2.12](#2.12)]. | -| 2 | The `Subscription` MUST allow the `Subscriber` to call `Subscription.Request` synchronously from within `OnNext` or `OnSubscribe`. | -| 3 | `Subscription.Request` MUST place an upper bound on possible synchronous recursion between `Publisher` and `Subscriber`[[1](#footnote-3-1)]. | -| 4 | `Subscription.Request` SHOULD respect the responsivity of its caller by returning in a timely manner[[2](#footnote-3-2)]. | -| 5 | `Subscription.Cancel` MUST respect the responsivity of its caller by returning in a timely manner[[2](#footnote-3-2)], MUST be idempotent and MUST be thread-safe. | -| 6 | After the `Subscription` is cancelled, additional `Subscription.Request(long n)` MUST be NOPs. | -| 7 | After the `Subscription` is cancelled, additional `Subscription.Cancel()` MUST be NOPs. | -| 8 | While the `Subscription` is not cancelled, `Subscription.Request(long n)` MUST register the given number of additional elements to be produced to the respective subscriber. | -| 9 | While the `Subscription` is not cancelled, `Subscription.Request(long n)` MUST signal `onError` with a `System.ArgumentException` if the argument is <= 0. The cause message MUST include a reference to this rule and/or quote the full rule. | -| 10 | While the `Subscription` is not cancelled, `Subscription.Request(long n)` MAY synchronously call `OnNext` on this (or other) subscriber(s). | -| 11 | While the `Subscription` is not cancelled, `Subscription.Request(long n)` MAY synchronously call `OnComplete` or `OnError` on this (or other) subscriber(s). | -| 12 | While the `Subscription` is not cancelled, `Subscription.Cancel()` MUST request the `Publisher` to eventually stop signaling its `Subscriber`. The operation is NOT REQUIRED to affect the `Subscription` immediately. | -| 13 | While the `Subscription` is not cancelled, `Subscription.Cancel()` MUST request the `Publisher` to eventually drop any references to the corresponding subscriber. Re-subscribing with the same `Subscriber` object is discouraged [see [2.12](#2.12)], but this specification does not mandate that it is disallowed since that would mean having to store previously cancelled subscriptions indefinitely. | -| 14 | While the `Subscription` is not cancelled, calling `Subscription.Cancel` MAY cause the `Publisher`, if stateful, to transition into the `shut-down` state if no other `Subscription` exists at this point [see [1.9](#1.9)]. -| 15 | Calling `Subscription.Cancel` MUST return normally. The only legal way to signal failure to a `Subscriber` is via the `OnError` method. | -| 16 | Calling `Subscription.Request` MUST return normally. The only legal way to signal failure to a `Subscriber` is via the `OnError` method. | -| 17 | A `Subscription` MUST support an unbounded number of calls to Request and MUST support a demand (sum requested - sum delivered) up to 2^63-1 (`System.Int64.MaxValue`). A demand equal or greater than 2^63-1 (`System.Int64.MaxValue`) MAY be considered by the `Publisher` as “effectively unbounded”[[3](#footnote-3-3)]. | - -[1] : An example for undesirable synchronous, open recursion would be `Subscriber.OnNext` -> `Subscription.Request` -> `Subscriber.OnNext` -> …, as it very quickly would result in blowing the calling Thread´s stack. +| 1 | `ISubscription.Request` and `ISubscription.Cancel` MUST only be called inside of its `ISubscriber` context. An `ISubscription` represents the unique relationship between an `ISubscriber` and an `IPublisher` [see [2.12](#2.12)]. | +| 2 | The `ISubscription` MUST allow the `ISubscriber` to call `ISubscription.Request` synchronously from within `OnNext` or `OnSubscribe`. | +| 3 | `ISubscription.Request` MUST place an upper bound on possible synchronous recursion between `IPublisher` and `ISubscriber`[[1](#footnote-3-1)]. | +| 4 | `ISubscription.Request` SHOULD respect the responsivity of its caller by returning in a timely manner[[2](#footnote-3-2)]. | +| 5 | `ISubscription.Cancel` MUST respect the responsivity of its caller by returning in a timely manner[[2](#footnote-3-2)], MUST be idempotent and MUST be thread-safe. | +| 6 | After the `ISubscription` is cancelled, additional `ISubscription.Request(long n)` MUST be NOPs. | +| 7 | After the `ISubscription` is cancelled, additional `ISubscription.Cancel()` MUST be NOPs. | +| 8 | While the `ISubscription` is not cancelled, `ISubscription.Request(long n)` MUST register the given number of additional elements to be produced to the respective subscriber. | +| 9 | While the `ISubscription` is not cancelled, `ISubscription.Request(long n)` MUST signal `onError` with a `System.ArgumentException` if the argument is <= 0. The cause message MUST include a reference to this rule and/or quote the full rule. | +| 10 | While the `ISubscription` is not cancelled, `ISubscription.Request(long n)` MAY synchronously call `OnNext` on this (or other) subscriber(s). | +| 11 | While the `ISubscription` is not cancelled, `ISubscription.Request(long n)` MAY synchronously call `OnComplete` or `OnError` on this (or other) subscriber(s). | +| 12 | While the `ISubscription` is not cancelled, `ISubscription.Cancel()` MUST request the `IPublisher` to eventually stop signaling its `ISubscriber`. The operation is NOT REQUIRED to affect the `ISubscription` immediately. | +| 13 | While the `ISubscription` is not cancelled, `ISubscription.Cancel()` MUST request the `IPublisher` to eventually drop any references to the corresponding subscriber. Re-subscribing with the same `ISubscriber` object is discouraged [see [2.12](#2.12)], but this specification does not mandate that it is disallowed since that would mean having to store previously cancelled subscriptions indefinitely. | +| 14 | While the `ISubscription` is not cancelled, calling `ISubscription.Cancel` MAY cause the `IPublisher`, if stateful, to transition into the `shut-down` state if no other `ISubscription` exists at this point [see [1.9](#1.9)]. +| 15 | Calling `ISubscription.Cancel` MUST return normally. The only legal way to signal failure to an `ISubscriber` is via the `OnError` method. | +| 16 | Calling `ISubscription.Request` MUST return normally. The only legal way to signal failure to an `ISubscriber` is via the `OnError` method. | +| 17 | An `ISubscription` MUST support an unbounded number of calls to Request and MUST support a demand (sum requested - sum delivered) up to 2^63-1 (`System.Int64.MaxValue`). A demand equal or greater than 2^63-1 (`System.Int64.MaxValue`) MAY be considered by the `IPublisher` as “effectively unbounded”[[3](#footnote-3-3)]. | + +[1] : An example for undesirable synchronous, open recursion would be `ISubscriber.OnNext` -> `ISubscription.Request` -> `ISubscriber.OnNext` -> …, as it very quickly would result in blowing the calling Thread´s stack. [2] : Avoid heavy computations and other things that would stall the caller´s thread of execution -[3] : As it is not feasibly reachable with current or foreseen hardware within a reasonable amount of time (1 element per nanosecond would take 292 years) to fulfill a demand of 2^63-1, it is allowed for a `Publisher` to stop tracking demand beyond this point. +[3] : As it is not feasibly reachable with current or foreseen hardware within a reasonable amount of time (1 element per nanosecond would take 292 years) to fulfill a demand of 2^63-1, it is allowed for an `IPublisher` to stop tracking demand beyond this point. -A `Subscription` is shared by exactly one `Publisher` and one `Subscriber` for the purpose of mediating the data exchange between this pair. This is the reason why the `Subscribe()` method does not return the created `Subscription`, but instead returns `void`; the `Subscription` is only passed to the `Subscriber` via the `OnSubscribe` callback. +An `ISubscription` is shared by exactly one `IPublisher` and one `ISubscriber` for the purpose of mediating the data exchange between this pair. This is the reason why the `Subscribe()` method does not return the created `ISubscription`, but instead returns `void`; the `ISubscription` is only passed to the `ISubscriber` via the `OnSubscribe` callback. -#### 4.Processor ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/IProcessor.cs)) +#### 4.IProcessor ([Code](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/src/api/Reactive.Streams/IProcessor.cs)) ```c# public interface IProcessor : ISubscriber, IPublisher { @@ -163,15 +163,15 @@ public interface IProcessor : ISubscriber, IPublisher { | ID | Rule | | ------------------------ | ------------------------------------------------------------------------------------------------------ | -| 1 | A `Processor` represents a processing stage—which is both a `Subscriber` and a `Publisher` and MUST obey the contracts of both. | -| 2 | A `Processor` MAY choose to recover an `onError` signal. If it chooses to do so, it MUST consider the `Subscription` cancelled, otherwise it MUST propagate the `onError` signal to its Subscribers immediately. | +| 1 | An `IProcessor` represents a processing stage—which is both an `ISubscriber` and an `IPublisher` and MUST obey the contracts of both. | +| 2 | An `IProcessor` MAY choose to recover an `onError` signal. If it chooses to do so, it MUST consider the `ISubscription` cancelled, otherwise it MUST propagate the `onError` signal to its ISubscribers immediately. | -While not mandated, it can be a good idea to cancel a `Processors` upstream `Subscription` when/if its last `Subscriber` cancels their `Subscription`, +While not mandated, it can be a good idea to cancel an `IProcessors` upstream `ISubscription` when/if its last `ISubscriber` cancels their `ISubscription`, to let the cancellation signal propagate upstream. ### Asynchronous vs Synchronous Processing ### -The Reactive Streams API prescribes that all processing of elements (`onNext`) or termination signals (`onError`, `onComplete`) MUST NOT *block* the `Publisher`. However, each of the `On*` handlers can process the events synchronously or asynchronously. +The Reactive Streams API prescribes that all processing of elements (`onNext`) or termination signals (`onError`, `onComplete`) MUST NOT *block* the `IPublisher`. However, each of the `On*` handlers can process the events synchronously or asynchronously. Take this example: @@ -179,7 +179,7 @@ Take this example: nioSelectorThreadOrigin map(f) filter(p) consumeTo(toNioSelectorOutput) ``` -It has an async origin and an async destination. Let's assume that both origin and destination are selector event loops. The `Subscription.Request(n)` must be chained from the destination to the origin. This is now where each implementation can choose how to do this. +It has an async origin and an async destination. Let's assume that both origin and destination are selector event loops. The `ISubscription.Request(n)` must be chained from the destination to the origin. This is now where each implementation can choose how to do this. The following uses the pipe `|` character to signal async boundaries (queue and schedule) and `R#` to represent resources (possibly threads). @@ -210,7 +210,7 @@ The Reactive Streams contract allows implementations the flexibility to manage r In order to allow fully asynchronous implementations of all participating API elements—`IPublisher`/`ISubscription`/`ISubscriber`/`IProcessor`—all methods defined by these interfaces return `void`. -### Subscriber controlled queue bounds ### +### ISubscriber controlled queue bounds ### One of the underlying design principles is that all buffer sizes are to be bounded and these bounds must be *known* and *controlled* by the subscribers. These bounds are expressed in terms of *element count* (which in turn translates to the invocation count of onNext). Any implementation that aims to support infinite streams (especially high output rate streams) needs to enforce bounds all along the way to avoid out-of-memory errors and constrain resource usage in general. @@ -221,11 +221,11 @@ Queue bounds can be controlled by a subscriber signaling demand for the appropri - the total number of elements requested: `P` - the number of elements that have been processed: `N` -Then the maximum number of elements that may arrive—until more demand is signaled to the Publisher—is `P - N`. In the case that the subscriber also knows the number of elements B in its input buffer then this bound can be refined to `P - B - N`. +Then the maximum number of elements that may arrive—until more demand is signaled to the IPublisher—is `P - N`. In the case that the subscriber also knows the number of elements B in its input buffer then this bound can be refined to `P - B - N`. These bounds must be respected by a publisher independent of whether the source it represents can be backpressured or not. In the case of sources whose production rate cannot be influenced—for example clock ticks or mouse movement—the publisher must choose to either buffer or drop elements to obey the imposed bounds. -Subscribers signaling a demand for one element after the reception of an element effectively implement a Stop-and-Wait protocol where the demand signal is equivalent to acknowledgement. By providing demand for multiple elements the cost of acknowledgement is amortized. It is worth noting that the subscriber is allowed to signal demand at any point in time, allowing it to avoid unnecessary delays between the publisher and the subscriber (i.e. keeping its input buffer filled without having to wait for full round-trips). +ISubscribers signaling a demand for one element after the reception of an element effectively implement a Stop-and-Wait protocol where the demand signal is equivalent to acknowledgement. By providing demand for multiple elements the cost of acknowledgement is amortized. It is worth noting that the subscriber is allowed to signal demand at any point in time, allowing it to avoid unnecessary delays between the publisher and the subscriber (i.e. keeping its input buffer filled without having to wait for full round-trips). ## Legal From d8964c0f391e1a812f96f950529584f88465aa94 Mon Sep 17 00:00:00 2001 From: Jordy Hulck Date: Thu, 29 Jun 2017 10:55:26 +0200 Subject: [PATCH 35/55] Update AsyncSubscriber.cs Subscritpion to Subscription Signed-off-by: Gregorius Soedharmo --- .../Reactive.Streams.Example.Unicast/AsyncSubscriber.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs b/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs index 82d3ce6..41d7110 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs @@ -50,10 +50,10 @@ private sealed class OnSubscribeSignal : ISignal { public OnSubscribeSignal(ISubscription subscription) { - Subscritpion = subscription; + Subscription = subscription; } - public ISubscription Subscritpion { get; } + public ISubscription Subscription { get; } } @@ -85,7 +85,7 @@ protected AsyncSubscriber() var subscribe = signal as OnSubscribeSignal; if (subscribe != null) { - HandleOnSubscribe(subscribe.Subscritpion); + HandleOnSubscribe(subscribe.Subscription); return; } From dac6326b36763f55c60ac558913dea5f6df33822 Mon Sep 17 00:00:00 2001 From: Alex Valuyskiy Date: Tue, 8 Aug 2017 18:55:27 +0300 Subject: [PATCH 36/55] Added xml documentation (#42) * added xml documentation * Updated NUnit runner Signed-off-by: Gregorius Soedharmo --- build.fsx | 18 ++++++++++-------- build.ps1 | 6 +++--- build.sh | 6 +++--- .../Reactive.Streams/Reactive.Streams.csproj | 8 ++------ ...active.Streams.Example.Unicast.Tests.csproj | 9 ++------- .../Reactive.Streams.Example.Unicast.csproj | 6 +----- .../Reactive.Streams.TCK.Tests.csproj | 9 ++------- .../Reactive.Streams.TCK.csproj | 9 ++++----- .../Reactive.Streams.TCK.nuspec | 6 ++++-- 9 files changed, 31 insertions(+), 46 deletions(-) diff --git a/build.fsx b/build.fsx index 1c70c05..80ef71c 100644 --- a/build.fsx +++ b/build.fsx @@ -62,15 +62,17 @@ Target "Build" (fun _ -> ) Target "RunTests" (fun _ -> - let nunitAssemblies = !! "./src/tck/Reactive.Streams.TCK.Tests/bin/Release/net45/Reactive.Streams.TCK.Tests.dll" - ++ "./src/examples/Reactive.Streams.Example.Unicast.Tests/bin/Release/net45/Reactive.Streams.Example.Unicast.Tests.dll" + let projects = !! "./src/**/Reactive.Streams.Example.Unicast.Tests.csproj" + ++ "./src/**/Reactive.Streams.TCK.Tests.csproj" - NUnit3 - (fun p -> - { p with - WorkingDir = outputTests; - TeamCity = true;}) - (nunitAssemblies) + let runSingleProject project = + DotNetCli.Test + (fun p -> + { p with + Project = project + Configuration = configuration }) + + projects |> Seq.iter (runSingleProject) ) //-------------------------------------------------------------------------------- diff --git a/build.ps1 b/build.ps1 index 03aadc6..96be84d 100644 --- a/build.ps1 +++ b/build.ps1 @@ -29,12 +29,12 @@ Param( [string[]]$ScriptArgs ) -$FakeVersion = "4.50.0" +$FakeVersion = "4.57.4" $NUnitVersion = "3.6.0" $DotNetChannel = "preview"; -$DotNetVersion = "1.0.0-rc4-004771"; +$DotNetVersion = "1.0.0"; $DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1"; -$NugetVersion = "3.5.0"; +$NugetVersion = "4.1.0"; $NugetUrl = "https://dist.nuget.org/win-x86-commandline/v$NugetVersion/nuget.exe" # Make sure tools folder exists diff --git a/build.sh b/build.sh index 383a803..93c2009 100644 --- a/build.sh +++ b/build.sh @@ -7,10 +7,10 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) TOOLS_DIR=$SCRIPT_DIR/tools NUGET_EXE=$TOOLS_DIR/nuget.exe -NUGET_URL=https://dist.nuget.org/win-x86-commandline/v3.5.0/nuget.exe -FAKE_VERSION=4.50.0 +NUGET_URL=https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe +FAKE_VERSION=4.57.4 FAKE_EXE=$TOOLS_DIR/FAKE/tools/FAKE.exe -DOTNET_VERSION=1.0.0-rc4-004771 +DOTNET_VERSION=1.0.0 DOTNET_INSTALLER_URL=https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh # Define default arguments. diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index 55a4747..aad21f6 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -4,20 +4,16 @@ Reactive.Streams Reactive Streams API CC0 1.0 Universal - 1.0.0 + 1.0.3 Reactive Streams netstandard1.0;net45 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ 1.6.0 + true - - - - - $(DefineConstants);RELEASE 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 910651d..f9bf5fc 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 @@ -13,13 +13,8 @@ - - - - - - - + + 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 b21f3a9..84be131 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 @@ -3,6 +3,7 @@ Reactive.Streams.Example.Unicast netstandard1.4;net45 + true @@ -13,11 +14,6 @@ - - - - - $(DefineConstants);RELEASE 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 ec61c22..4444511 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 @@ -13,13 +13,8 @@ - - - - - - - + + diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 746c960..1f9e4da 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj @@ -4,12 +4,13 @@ Reactive.Streams.TCK Reactive Streams Technology Compatibility Kit CC0 1.0 Universal - 1.0.0 + 1.0.3 Reactive Streams net45 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ + true @@ -17,10 +18,8 @@ - - - - + + diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec index f58221b..80146ca 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec @@ -2,7 +2,7 @@ Reactive.Streams.TCK - 1.0.0 + 1.0.3 Reactive Streams Reactive Streams false @@ -13,13 +13,15 @@ reactive stream - + + + \ No newline at end of file From a819a0ec057f30440a23b2657185215f385a2d77 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Wed, 12 Aug 2020 13:12:10 +0200 Subject: [PATCH 37/55] Preparing for relicensing to MIT-0 Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Relicensing.txt diff --git a/Relicensing.txt b/Relicensing.txt new file mode 100644 index 0000000..8fdc953 --- /dev/null +++ b/Relicensing.txt @@ -0,0 +1,7 @@ +The following copyright holders agree that all of their contributions originally submitted to this project under Creative Commons +Zero 1.0 Universal (SPDX: CC0-1.0) license are hereby relicensed to MIT No Attribution (SPDX: MIT-0) license, and are submitted pursuant to the Developer Certificate of Origin, version 1.1: + + +github name | Real Name, Email Address used for git commits, Company +---------------+---------------------------------------------------------------------------- +viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. \ No newline at end of file From 785397d8e1b3b7c71c82f0ca29d5fdb64ce1abad Mon Sep 17 00:00:00 2001 From: David Karnok Date: Wed, 12 Aug 2020 13:57:18 +0200 Subject: [PATCH 38/55] Update Relicensing.txt Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Relicensing.txt b/Relicensing.txt index 8fdc953..5f77c00 100644 --- a/Relicensing.txt +++ b/Relicensing.txt @@ -4,4 +4,5 @@ Zero 1.0 Universal (SPDX: CC0-1.0) license are hereby relicensed to MIT No Attri github name | Real Name, Email Address used for git commits, Company ---------------+---------------------------------------------------------------------------- -viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. \ No newline at end of file +viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. +akarnokd | David Karnok, akarnokd@gmail.com From b68530ba749c11042472a2ddb041db0c78a41b07 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 19:44:51 +0700 Subject: [PATCH 39/55] Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact] Signed-off-by: Gregorius Soedharmo --- .gitignore | 3 +- .../Reactive.Streams/Reactive.Streams.csproj | 3 +- .../AsyncSubscriberTest.cs | 5 +- .../IterablePublisherTest.cs | 3 +- ...ctive.Streams.Example.Unicast.Tests.csproj | 9 +- .../SyncSubscriberTest.cs | 3 +- .../SyncSubscriberWhiteboxTest.cs | 3 +- .../UnboundedIntegerIncrementPublisherTest.cs | 3 +- .../Reactive.Streams.Example.Unicast.csproj | 6 +- src/tck/README.md | 10 +- .../EmptyLazyPublisherTest.cs | 4 +- ...tityProcessorVerificationDelegationTest.cs | 13 +- .../IdentityProcessorVerificationTest.cs | 7 +- .../PublisherVerificationTest.cs | 73 ++++----- .../RangePublisherTest.cs | 3 +- .../Reactive.Streams.TCK.Tests.csproj | 9 +- .../SingleElementPublisherTest.cs | 3 +- .../SubscriberBlackboxVerificationTest.cs | 31 ++-- .../SubscriberWhiteboxVerificationTest.cs | 29 ++-- .../Support/TCKVerificationSupport.cs | 3 +- .../SyncTriggeredDemandSubscriberTest.cs | 3 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 3 +- .../IdentityProcessorVerification.cs | 138 +++++++++--------- .../PublisherVerification.cs | 78 +++++----- .../Reactive.Streams.TCK.csproj | 6 +- .../SubscriberBlackboxVerification.cs | 56 +++---- .../SubscriberWhiteboxVerification.cs | 59 ++++---- .../Reactive.Streams.TCK/TestEnvironment.cs | 3 +- 28 files changed, 297 insertions(+), 272 deletions(-) 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/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index aad21f6..0f1fb51 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -6,11 +6,10 @@ CC0 1.0 Universal 1.0.3 Reactive Streams - netstandard1.0;net45 + netstandard2.0;net452 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 1fe3c62..6435138 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -1,6 +1,7 @@ using System; using System.Threading; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; using Reactive.Streams.TCK.Support; @@ -22,7 +23,7 @@ private sealed class Suscriber : AsyncSubscriber protected override bool WhenNext(int? element) => true; } - [Test] + [SkippableFact] public void TestAccumulation() { var i = new AtomicCounterLong(0); diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index a62e30c..7a22b01 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -1,7 +1,8 @@ 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 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..0736f03 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 win7-x64 @@ -12,9 +12,10 @@ - - - + + + + diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index 3567681..9a9bc40 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; namespace Reactive.Streams.Example.Unicast.Tests diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index b3b3df5..45d76c1 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK; namespace Reactive.Streams.Example.Unicast.Tests diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 7d3bced..38a7e43 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -1,7 +1,8 @@ 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 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..f7f1b36 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;net452 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 7db2d31..53ce92f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -1,10 +1,10 @@ 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()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs index f2ef0c1..16a55f7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs @@ -3,7 +3,8 @@ using System.Linq; using System.Reflection; using System.Text; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; namespace Reactive.Streams.TCK.Tests { @@ -16,7 +17,7 @@ namespace Reactive.Streams.TCK.Tests /// public class IdentityProcessorVerificationDelegationTest { - [Test] + [SkippableFact] public void ShouldIncludeAllTestsFromPublisherVerification() { var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList(); @@ -25,7 +26,7 @@ public void ShouldIncludeAllTestsFromPublisherVerification() typeof(PublisherVerification<>), publisherTests); } - [Test] + [SkippableFact] public void ShouldIncludeAllTestsFromSubscriberVerification() { var processeroTests = GetTestNames(typeof(IdentityProcessorVerification<>)).ToList(); @@ -42,7 +43,7 @@ private static void AssertSuiteDelegatedAllTests(Type delegatingFrom, IList delegate{targetClass.Name}.{targetTest}();"); Assert.True(TestsInclude(allTests, targetTest), message.ToString()); @@ -54,7 +55,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 52542ed..4e59f32 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests @@ -11,7 +12,7 @@ public class IdentityProcessorVerificationTest : TCKVerificationSupport private static readonly long DefaultNoSignalsTimeoutMilliseconds = TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds(); - [Test] + [SkippableFact] public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldBeIgnored() { RequireTestSkip(() => @@ -98,7 +99,7 @@ public Spec104WaitingVerification(TestEnvironment environment, long publisherRef public override IPublisher CreateFailedPublisher() => null; } - [Test] + [SkippableFact] public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError_shouldFailWhileWaitingForOnError() { RequireTestFailure(() => diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index 0fb7a2a..d0da450 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -1,7 +1,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; @@ -13,22 +14,22 @@ namespace Reactive.Streams.TCK.Tests /// public class PublisherVerificationTest : TCKVerificationSupport { - [Test] + [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()); @@ -94,7 +95,7 @@ public void Subscribe(ISubscriber subscriber) })); } - [Test] + [SkippableFact] public void Stochastic_spec103_mustSignalOnMethodsSequentially_shouldPass_forSynchronousPublisher() { var publisher = new LamdaPublisher(onSubscribe: subscriber => @@ -112,7 +113,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 => @@ -124,12 +125,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 => @@ -150,7 +151,7 @@ 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()); @@ -184,7 +185,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(); @@ -202,7 +203,7 @@ public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSigna } } - [Test] + [SkippableFact] public void Required_spec107_mustNotEmitFurtherSignalsOnceOnCompleteHasBeenSignalled_shouldFailForPublisherWhichCompletesButKeepsServingData() { var publisher = new LamdaPublisher(onSubscribe: subscriber => @@ -228,7 +229,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 => { }); @@ -237,7 +238,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 => @@ -249,7 +250,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()); @@ -258,7 +259,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)); @@ -267,7 +268,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())); @@ -276,7 +277,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())); @@ -285,25 +286,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(); @@ -320,12 +321,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 => @@ -340,16 +341,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 => @@ -364,17 +365,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(); @@ -392,7 +393,7 @@ public void Required_spec312_cancelMustMakeThePublisherToEventuallyStopSignaling } } - [Test] + [SkippableFact] public void Required_spec313_cancelMustMakeThePublisherEventuallyDropAllReferencesToTheSubscriber_shouldFailBy_keepingTheReferenceLongerThanNeeded() { ISubscriber sub; @@ -414,7 +415,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(); @@ -432,12 +433,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; @@ -459,7 +460,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; @@ -481,7 +482,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); diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 7703d94..2ecfa63 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using System; using System.Collections.Concurrent; using System.Collections.Generic; 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..d61df44 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,10 @@ - - - + + + + diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index 967be00..649a8ae 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -1,5 +1,6 @@ using System.Linq; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.Example.Unicast; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index 606a0b1..5dd3a8c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests @@ -11,17 +12,17 @@ namespace Reactive.Streams.TCK.Tests [TestFixture] public class SubscriberBlackboxVerificationTest : TCKVerificationSupport { - [Test] + [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; @@ -32,7 +33,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; @@ -43,7 +44,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; @@ -54,7 +55,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; @@ -65,7 +66,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; @@ -79,18 +80,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 => @@ -103,25 +104,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(), diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index f749bcb..e7dbc84 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -1,6 +1,7 @@ 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,7 +14,7 @@ namespace Reactive.Streams.TCK.Tests [TestFixture] public class SubscriberWhiteboxVerificationTest : TCKVerificationSupport { - [Test] + [SkippableFact] public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() { // this mostly verifies the probe is injected correctly @@ -34,11 +35,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 => @@ -59,7 +60,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 => @@ -81,7 +82,7 @@ public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnComp } - [Test] + [SkippableFact] public void Required_spec203_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingRequest() { Func, ISubscriber> createSubscriber = probe => @@ -101,7 +102,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 => @@ -121,7 +122,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 => @@ -137,7 +138,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 => @@ -173,7 +174,7 @@ public void Required_spec208_mustBePreparedToReceiveOnNextSignalsAfterHavingCall "But I thought it's cancelled!"); } - [Test] + [SkippableFact] public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -188,7 +189,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithPreced "did not call `RegisterOnComplete()`"); } - [Test] + [SkippableFact] public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPrecedingRequestCall_shouldPass_withNoopSubscriber() { Func, ISubscriber> createSubscriber = probe => @@ -203,7 +204,7 @@ public void Required_spec209_mustBePreparedToReceiveAnOnCompleteSignalWithoutPre "did not call `RegisterOnSubscribe`"); } - [Test] + [SkippableFact] public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -219,7 +220,7 @@ public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithPreceding "Test Exception: Boom!"); } - [Test] + [SkippableFact] public void Required_spec210_mustBePreparedToReceiveAnOnErrorSignalWithoutPrecedingRequestCall_shouldFail() { Func, ISubscriber> createSubscriber = probe => @@ -235,7 +236,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 diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index a610fb2..9bbaabb 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK.Tests.Support diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index e1b1280..77040f7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index 94a360d..be045b7 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -1,5 +1,6 @@ using System; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; namespace Reactive.Streams.TCK.Tests diff --git a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs index 5b6281d..9c59240 100644 --- a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs +++ b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; -using NUnit.Framework; +using Xunit; +using Xunit.Abstractions; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK @@ -52,6 +53,8 @@ protected IdentityProcessorVerification(TestEnvironment environment, long publis _processorBufferSize = processorBufferSize; _subscriberVerification = new IdentifierWhiteboxVerification(this); _publisherVerification = new IdentifierPublisherVerification(this, publisherReferenceGcTimeoutMillis); + + SetUp(); } private sealed class IdentifierPublisherVerification : PublisherVerification @@ -154,7 +157,6 @@ public override ISubscriber CreateSubscriber(WhiteboxSubscriberProbe probe ////////////////////// TEST ENV CLEANUP ///////////////////////////////////// - [SetUp] public void SetUp() { _publisherVerification.SetUp(); @@ -171,11 +173,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(); @@ -183,146 +185,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 => { @@ -419,7 +421,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); @@ -436,85 +438,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(); @@ -522,7 +524,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 4d3e1ca..f0765c6 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1,7 +1,9 @@ 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; @@ -31,6 +33,7 @@ protected PublisherVerification(TestEnvironment environment, long publisherRefer { _environment = environment; _publisherReferenceGcTimeoutMillis = publisherReferenceGcTimeoutMillis; + SetUp(); } /// @@ -113,12 +116,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 = @@ -134,7 +136,7 @@ public void Required_createPublisher1MustProduceAStreamOfExactly1Element() }); } - [Test] + [SkippableFact] public void Required_createPublisher3MustProduceAStreamOfExactly3Elements() { Func, ManualSubscriber, Option> requestNextElementOrEndOfStream = @@ -152,11 +154,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"); @@ -164,7 +166,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 => { @@ -190,7 +192,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; @@ -206,7 +208,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; @@ -332,7 +334,7 @@ public void OnComplete() } // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.4 - [Test] + [SkippableFact] public void Optional_spec104_mustSignalOnErrorWhenFails() { try @@ -392,7 +394,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 => { @@ -405,7 +407,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 => { @@ -416,12 +418,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 => { @@ -435,22 +437,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 => { @@ -469,7 +471,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 => { @@ -521,7 +523,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 => { @@ -563,12 +565,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 => { @@ -592,7 +594,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 => { @@ -648,7 +650,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 - [Test] + [SkippableFact] public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfront() => OptionalActivePublisherTest(3, false, publisher => { @@ -675,7 +677,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen }); // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#1.11 - [Test] + [SkippableFact] public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequenceToAllOfItsSubscribersWhenRequestingManyUpfrontAndCompleteAsExpected() => OptionalActivePublisherTest(3, true, publisher => { @@ -704,7 +706,7 @@ public void Optional_spec111_multicast_mustProduceTheSameElementsInTheSameSequen ///////////////////// 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 => { @@ -735,7 +737,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; @@ -832,17 +834,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 => { @@ -877,7 +879,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 => { @@ -895,7 +897,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 => { @@ -905,7 +907,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 => { @@ -916,7 +918,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 @@ -974,7 +976,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 => @@ -1007,7 +1009,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; @@ -1025,7 +1027,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; @@ -1052,7 +1054,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 => { diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 1f9e4da..36cf106 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 @@ CC0 1.0 Universal 1.0.3 Reactive Streams - net45 + net452;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 a093679..ad02a1b 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -1,7 +1,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 @@ -22,6 +23,8 @@ public abstract class SubscriberBlackboxVerification : WithHelperPublisher protected SubscriberBlackboxVerification(TestEnvironment environment) { Environment = environment; + + Setup(); } // USER API @@ -44,13 +47,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 => { @@ -63,12 +65,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 => { @@ -81,7 +83,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 => { @@ -124,12 +126,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 () @@ -166,12 +168,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 () @@ -179,12 +181,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 => { @@ -238,7 +240,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 => { @@ -258,7 +260,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 => { @@ -267,24 +269,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 => { @@ -306,7 +308,7 @@ 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 => { @@ -332,7 +334,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 => { @@ -368,37 +370,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? diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index 8146bbb..13dace1 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -1,7 +1,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 @@ -17,6 +18,7 @@ public abstract class SubscriberWhiteboxVerification : WithHelperPublisher protected SubscriberWhiteboxVerification(TestEnvironment environment) { _environment = environment; + SetUp(); } // USER API @@ -32,13 +34,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 => { @@ -66,7 +67,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 => { @@ -77,12 +78,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 => { @@ -128,7 +129,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 => { @@ -173,12 +174,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 => { @@ -214,18 +215,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 => { @@ -240,7 +241,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 => { @@ -252,7 +253,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 => { @@ -263,7 +264,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 => { @@ -278,7 +279,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 => { @@ -290,22 +291,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 => { @@ -325,7 +326,7 @@ 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 => { @@ -349,7 +350,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 => { @@ -371,12 +372,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 => { @@ -391,27 +392,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? diff --git a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index 4f9829f..d4b1933 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -2,7 +2,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 From fbf7f3591c95290d8f43f0db407846b6d26a2426 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 19:49:17 +0700 Subject: [PATCH 40/55] Replace IgnoreException with SkipException Signed-off-by: Gregorius Soedharmo --- .../Support/TCKVerificationSupport.cs | 4 ++-- src/tck/Reactive.Streams.TCK/PublisherVerification.cs | 2 +- .../Reactive.Streams.TCK/SubscriberBlackboxVerification.cs | 2 +- .../Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index 9bbaabb..62fef60 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -42,7 +42,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 @@ -52,7 +52,7 @@ public void RequireTestSkip(Action throwingRun, string messagePart) { throwingRun(); } - catch (IgnoreException ignore) + catch (SkipException ignore) { if(ignore.Message.Contains(messagePart)) return; diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index f0765c6..82cfd5c 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -353,7 +353,7 @@ public void Optional_spec104_mustSignalOnErrorWhenFails() _environment.VerifyNoAsyncErrors(); }); } - catch (IgnoreException) + catch (SkipException) { throw; } diff --git a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index ad02a1b..d37fb55 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -314,7 +314,7 @@ public void Required_spec213_blackbox_onNext_mustThrowNullPointerExceptionWhenPa { 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; diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index 13dace1..414e1c6 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -332,7 +332,7 @@ public void Required_spec213_onNext_mustThrowNullPointerExceptionWhenParametersA { 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; From 39d5b7b84ecb13307967ea14b26321720640bc6e Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 20:22:20 +0700 Subject: [PATCH 41/55] Replace `Assert.Ignore` with `TckAssert.Skip` and `Assert.Fail` with `TckAssert.Fail` Signed-off-by: Gregorius Soedharmo --- .../Support/TCKVerificationSupport.cs | 2 +- .../Reactive.Streams.TCK/PublisherVerification.cs | 14 +++++++------- .../SubscriberBlackboxVerification.cs | 2 +- .../SubscriberWhiteboxVerification.cs | 2 +- src/tck/Reactive.Streams.TCK/TestEnvironment.cs | 15 +++++++-------- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index 62fef60..ac715c4 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -132,7 +132,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/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 82cfd5c..8fe3818 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1119,9 +1119,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); @@ -1139,9 +1139,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."; @@ -1181,7 +1181,7 @@ public void PotentiallyPendingTest(IPublisher publisher, Action if (publisher != null) run(publisher); else - Assert.Ignore(message); + TckAssert.Skip(message); } /// @@ -1191,7 +1191,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); @@ -1199,7 +1199,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/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index d37fb55..2312215 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -416,7 +416,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 414e1c6..bb078c5 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -456,7 +456,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/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index d4b1933..3f4e5fc 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -148,7 +148,7 @@ public void Flop(string message) { try { - Assert.Fail(message); + TckAssert.Fail(message); } catch (Exception ex) { @@ -172,7 +172,7 @@ public void Flop(Exception exception, string message) { try { - Assert.Fail(message, exception); + TckAssert.Fail(message, exception); } catch (Exception) { @@ -196,7 +196,7 @@ public void Flop(Exception exception) { try { - Assert.Fail(exception.Message, exception); + TckAssert.Fail(exception.Message, exception); } catch (Exception) { @@ -220,12 +220,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 @@ -304,11 +304,10 @@ 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); } } From 463a68c10e69e3faa2adff70ae833acc8d8321d3 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:15:33 +0700 Subject: [PATCH 42/55] replace Assert functions to the equivalent version in Xunit Signed-off-by: Gregorius Soedharmo --- .../AsyncSubscriberTest.cs | 2 +- .../IterablePublisherTest.cs | 3 ++- .../PublisherVerification.cs | 17 ++++++++++------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 6435138..59b762c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -31,7 +31,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 7a22b01..fd2367f 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -16,7 +16,8 @@ public IterablePublisherTest() : base(new TestEnvironment()) 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/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 8fe3818..e0ee3de 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -644,8 +644,8 @@ 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"); }); @@ -671,9 +671,10 @@ 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 @@ -699,8 +700,10 @@ 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 ////////////////////////////////// From 380a84137bebfdb220e9c0bcca080cad46ca5bce Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:16:09 +0700 Subject: [PATCH 43/55] Add `Assert.Fail` and `Assert.Ignore` support Signed-off-by: Gregorius Soedharmo --- .../Support/AssertionException.cs | 47 +++++++++ .../Reactive.Streams.TCK/Support/TckAssert.cs | 95 +++++++++++++++++++ 2 files changed, 142 insertions(+) create mode 100644 src/tck/Reactive.Streams.TCK/Support/AssertionException.cs create mode 100644 src/tck/Reactive.Streams.TCK/Support/TckAssert.cs 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 + } +} From f43349c38366d8e71aa51de11e733a38054175b3 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:23:00 +0700 Subject: [PATCH 44/55] Remove TextFixtureAttribute Signed-off-by: Gregorius Soedharmo --- .../AsyncSubscriberTest.cs | 1 - .../IterablePublisherTest.cs | 1 - .../SyncSubscriberTest.cs | 1 - .../SyncSubscriberWhiteboxTest.cs | 4 +- .../UnboundedIntegerIncrementPublisherTest.cs | 1 - .../IdentityProcessorVerificationTest.cs | 2 - .../PublisherVerificationTest.cs | 2 - .../RangePublisherTest.cs | 50 +++++++++---------- .../SingleElementPublisherTest.cs | 1 - .../SubscriberBlackboxVerificationTest.cs | 22 -------- .../SubscriberWhiteboxVerificationTest.cs | 18 ------- .../SyncTriggeredDemandSubscriberTest.cs | 1 - ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 1 - 13 files changed, 26 insertions(+), 79 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 59b762c..2c91c77 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class AsyncSubscriberTest : SubscriberBlackboxVerification { public AsyncSubscriberTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index fd2367f..f3b9c6c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class IterablePublisherTest : PublisherVerification { public IterablePublisherTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index 9a9bc40..b69d903 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class SyncSubscriberTest : SubscriberBlackboxVerification { public SyncSubscriberTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index 45d76c1..32815ac 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -5,10 +5,9 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class ValueTypeSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification { - public ValueTypeSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) + public ValueTypeSyncSubscriberWhiteboxTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } @@ -68,7 +67,6 @@ public override void OnComplete() } } - [TestFixture] public class NullableSyncSubscriberWhiteboxTest : SubscriberWhiteboxVerification { public NullableSyncSubscriberWhiteboxTest() : base(new TestEnvironment()) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 38a7e43..722d12b 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -7,7 +7,6 @@ namespace Reactive.Streams.Example.Unicast.Tests { - [TestFixture] public class UnboundedIntegerIncrementPublisherTest : PublisherVerification { public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index 4e59f32..bcf6296 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -22,7 +22,6 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo }, "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 { /// @@ -109,7 +108,6 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo }, "Did not receive expected error on downstream within " + DefaultTimeoutMilliseconds); } - [TestFixture(Ignore = "Helper verification for single test")] private sealed class Spec104IgnoreVerification : IdentityProcessorVerification { /// diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index d0da450..c21d8f5 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -160,7 +160,6 @@ public void Optional_spec105_emptyStreamMustTerminateBySignallingOnComplete_shou "Subscriber.OnComplete() called before Subscriber.OnSubscribe"); } - [TestFixture(Ignore = "Helper for single test")] private sealed class Spec105Verification : PublisherVerification { private readonly IPublisher _publisher; @@ -655,7 +654,6 @@ public void Subscribe(ISubscriber subscriber) })); } - [TestFixture(Ignore = "Helper for single test")] private sealed class SimpleVerification : PublisherVerification { private readonly IPublisher _publisher; diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 2ecfa63..9780122 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -11,8 +11,8 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] - public class RangePublisherTest : PublisherVerification + //[TestFixture] + public class RangePublisherTest : PublisherVerification, IDisposable { static readonly ConcurrentDictionary stacks = new ConcurrentDictionary(); @@ -20,29 +20,6 @@ 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()) { @@ -189,5 +166,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/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index 649a8ae..d1edb39 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SingleElementPublisherTest : PublisherVerification { public SingleElementPublisherTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index 5dd3a8c..29cc8af 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -9,7 +9,6 @@ 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 { [SkippableFact] @@ -137,15 +136,8 @@ public void Required_spec213_blackbox_mustThrowNullPointerExceptionWhenParameter private SubscriberBlackboxVerification NoopSubscriberVerification() => new NoopBlackboxVerification(new TestEnvironment()); - [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,15 +153,8 @@ public NoopBlackboxVerification(TestEnvironment environment) : base(environment) private SubscriberBlackboxVerification SimpleSubscriberVerification() => new SimpleBlackboxVerification(new TestEnvironment()); - [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,17 +180,10 @@ public override ISubscriber CreateSubscriber() private SubscriberBlackboxVerification CustomSubscriberVerification(ISubscriber subscriber) => new CustomBlackboxVerification(new TestEnvironment(), 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 e7dbc84..a67217f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -257,17 +257,8 @@ public void Required_spec308_requestMustRegisterGivenNumberElementsToBeProduced_ private SubscriberWhiteboxVerification SimpleSubscriberVerification() => new SimpleWhiteboxVerification(new TestEnvironment()); - [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,19 +282,10 @@ public SimpleWhiteboxVerification(TestEnvironment environment) : base(environmen Func, ISubscriber> newSubscriber) => new CustomWhiteboxVerification(new TestEnvironment(), 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/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 77040f7..2d3e88c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -4,7 +4,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SyncTriggeredDemandSubscriberTest : SubscriberBlackboxVerification { public SyncTriggeredDemandSubscriberTest() : base(new TestEnvironment()) diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index be045b7..8f6da21 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -5,7 +5,6 @@ namespace Reactive.Streams.TCK.Tests { - [TestFixture] public class SyncTriggeredDemandSubscriberWhiteboxTest : SubscriberWhiteboxVerification { public SyncTriggeredDemandSubscriberWhiteboxTest() : base(new TestEnvironment()) From 7fd7136328b1d9c5ca154adc2a024b5be622bd3e Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:05 +0700 Subject: [PATCH 45/55] Add ITestOutputHelper support Signed-off-by: Gregorius Soedharmo --- .../AsyncSubscriberTest.cs | 2 +- .../IterablePublisherTest.cs | 2 +- .../SyncSubscriberTest.cs | 15 ++++++-- .../SyncSubscriberWhiteboxTest.cs | 2 +- .../UnboundedIntegerIncrementPublisherTest.cs | 2 +- .../EmptyLazyPublisherTest.cs | 2 +- .../IdentityProcessorVerificationTest.cs | 19 +++++++--- .../PublisherVerificationTest.cs | 28 ++++++++------ .../RangePublisherTest.cs | 3 +- .../SingleElementPublisherTest.cs | 2 +- .../SubscriberBlackboxVerificationTest.cs | 13 +++++-- .../SubscriberWhiteboxVerificationTest.cs | 12 ++++-- .../SyncTriggeredDemandSubscriberTest.cs | 2 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 2 +- .../Reactive.Streams.TCK/TestEnvironment.cs | 37 ++++++++++--------- 15 files changed, 89 insertions(+), 54 deletions(-) diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index 2c91c77..f674553 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class AsyncSubscriberTest : SubscriberBlackboxVerification { - public AsyncSubscriberTest() : base(new TestEnvironment()) + public AsyncSubscriberTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index f3b9c6c..77804a8 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class IterablePublisherTest : PublisherVerification { - public IterablePublisherTest() : base(new TestEnvironment()) + public IterablePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index b69d903..cac58cd 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -7,25 +7,34 @@ namespace Reactive.Streams.Example.Unicast.Tests { 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 32815ac..54c65f2 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -69,7 +69,7 @@ public override void OnComplete() 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 722d12b..6eab2f6 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -9,7 +9,7 @@ namespace Reactive.Streams.Example.Unicast.Tests { public class UnboundedIntegerIncrementPublisherTest : PublisherVerification { - public UnboundedIntegerIncrementPublisherTest() : base(new TestEnvironment()) + public UnboundedIntegerIncrementPublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs index 53ce92f..5405913 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index bcf6296..f069039 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -12,12 +12,19 @@ public class IdentityProcessorVerificationTest : TCKVerificationSupport private static readonly long DefaultNoSignalsTimeoutMilliseconds = TestEnvironment.EnvironmentDefaultNoSignalsTimeoutMilliseconds(); + 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"); } @@ -27,7 +34,7 @@ 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)) { } @@ -103,7 +110,7 @@ public void Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANo { RequireTestFailure(() => { - new Spec104WaitingVerification(NewTestEnvironment(), DefaultTimeoutMilliseconds) + new Spec104WaitingVerification(NewTestEnvironment(_output), DefaultTimeoutMilliseconds) .Required_spec104_mustCallOnErrorOnAllItsSubscribersIfItEncountersANonRecoverableError(); }, "Did not receive expected error on downstream within " + DefaultTimeoutMilliseconds); } @@ -113,7 +120,7 @@ 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)) { } @@ -134,8 +141,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 c21d8f5..3a8d808 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -14,6 +14,13 @@ namespace Reactive.Streams.TCK.Tests /// public class PublisherVerificationTest : TCKVerificationSupport { + private readonly ITestOutputHelper _output; + + public PublisherVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements_shouldFailBy_ExpectingOnError() => RequireTestFailure(() => NoopPublisherVerification().Required_spec101_subscriptionRequestMustResultInTheCorrectNumberOfProducedElements(), @@ -155,7 +162,7 @@ public void Required_spec105_mustSignalOnCompleteWhenFiniteStreamTerminates_shou 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"); } @@ -167,7 +174,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) { } @@ -505,7 +512,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 // @@ -521,7 +528,7 @@ private PublisherVerification NoopPublisherVerification() subscriber.OnSubscribe(new LamdaSubscription()); }); - return new SimpleVerification(NewTestEnvironment(), publisher); + return new SimpleVerification(new TestEnvironment(_output), publisher); } /// @@ -537,21 +544,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 @@ -567,7 +574,7 @@ private PublisherVerification DemandIgnoringSynchronousPublisherVerificatio subscriber.OnNext((int)i); })); }); - return new SimpleVerification(new TestEnvironment(), publisher); + return new SimpleVerification(new TestEnvironment(_output), publisher); } /// @@ -583,7 +590,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 { @@ -662,7 +669,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) { @@ -675,6 +682,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 9780122..426fa87 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -20,8 +20,7 @@ public class RangePublisherTest : PublisherVerification, IDisposable static int id; - - public RangePublisherTest() : base(new TestEnvironment()) + public RangePublisherTest(ITestOutputHelper output) : base(new TestEnvironment(output)) { } diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index d1edb39..c67eb51 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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 29cc8af..a1d376e 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -11,6 +11,13 @@ namespace Reactive.Streams.TCK.Tests /// public class SubscriberBlackboxVerificationTest : TCKVerificationSupport { + private readonly ITestOutputHelper _output; + + public SubscriberBlackboxVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() => RequireTestFailure( @@ -134,7 +141,7 @@ 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)); private sealed class NoopBlackboxVerification : SubscriberBlackboxVerification { @@ -151,7 +158,7 @@ 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)); private sealed class SimpleBlackboxVerification : SubscriberBlackboxVerification { @@ -178,7 +185,7 @@ 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); private sealed class CustomBlackboxVerification : SubscriberBlackboxVerification { diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index a67217f..efbd695 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -11,9 +11,15 @@ 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 { + private readonly ITestOutputHelper _output; + + public SubscriberWhiteboxVerificationTest(ITestOutputHelper output) + { + _output = output; + } + [SkippableFact] public void Required_spec201_mustSignalDemandViaSubscriptionRequest_shouldFailBy_notGettingRequestCall() { @@ -255,7 +261,7 @@ 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)); private sealed class SimpleWhiteboxVerification : SubscriberWhiteboxVerification { @@ -280,7 +286,7 @@ public SimpleWhiteboxVerification(TestEnvironment environment) : base(environmen /// private SubscriberWhiteboxVerification CustomSubscriberVerification( Func, ISubscriber> newSubscriber) - => new CustomWhiteboxVerification(new TestEnvironment(), newSubscriber); + => new CustomWhiteboxVerification(new TestEnvironment(_output), newSubscriber); private sealed class CustomWhiteboxVerification : SubscriberWhiteboxVerification { diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 2d3e88c..23ea52b 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -6,7 +6,7 @@ namespace Reactive.Streams.TCK.Tests { 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 8f6da21..df5d9a4 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -7,7 +7,7 @@ namespace Reactive.Streams.TCK.Tests { 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/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index 3f4e5fc..ff6b661 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -15,6 +15,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 @@ -24,12 +25,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; } /// @@ -39,8 +40,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) { } @@ -51,11 +55,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) { } @@ -65,8 +69,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) { } @@ -81,11 +88,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(); /// @@ -312,12 +314,11 @@ public void VerifyNoAsyncErrorsNoDelay() } /// - /// 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}"); } /// From 5ff3cba7acfdb701fabaac617273871898eeb0fa Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:42 +0700 Subject: [PATCH 46/55] Fix OptionalActivePublisherTest, it was eating all exceptions Signed-off-by: Gregorius Soedharmo --- src/tck/Reactive.Streams.TCK/PublisherVerification.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index e0ee3de..398967c 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -6,8 +6,6 @@ using Xunit.Abstractions; using Reactive.Streams.TCK.Support; -//using Reactive.Streams.TCK.Support; - namespace Reactive.Streams.TCK { public abstract class PublisherVerification : IPublisherVerificationRules @@ -1157,10 +1155,12 @@ public void OptionalActivePublisherTest(long elements, bool completionSignalRequ { NotVerified(skipMessage + "Reason for skipping was: " + ex.Message); } + /* catch (Exception) { NotVerified(skipMessage); } + */ } public const string SkippingNoErrorPublisherAvailable = From bc73d6b674f4eabf2ce39b2d9dfd60b75b51c191 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 22:24:59 +0700 Subject: [PATCH 47/55] Turn on netcoreapp3.1 testing Signed-off-by: Gregorius Soedharmo --- .../Reactive.Streams.Example.Unicast.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0736f03..f0b48d9 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 - net461 + net461;netcoreapp3.1 win7-x64 From 79008d100f8f44f0a5f2e7f68584417904ac7410 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Sat, 22 Aug 2020 00:37:17 +0700 Subject: [PATCH 48/55] Update build script to dotnet 3.1.105 LTS, add RunTestsDotNet build args Signed-off-by: Gregorius Soedharmo --- build.fsx | 126 +++++++++++++++++++++++++++++---------- build.ps1 | 25 ++------ src/Reactive.Streams.sln | 18 +++--- 3 files changed, 110 insertions(+), 59 deletions(-) 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 From 07b7f262ccac9ec3d72baa2f0e2731d96044ec18 Mon Sep 17 00:00:00 2001 From: Marc Piechura Date: Thu, 20 Aug 2020 00:39:05 +0200 Subject: [PATCH 49/55] Added me to relicensing file Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Relicensing.txt b/Relicensing.txt index 5f77c00..eca5076 100644 --- a/Relicensing.txt +++ b/Relicensing.txt @@ -6,3 +6,4 @@ github name | Real Name, Email Address used for git commits, Company ---------------+---------------------------------------------------------------------------- viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. akarnokd | David Karnok, akarnokd@gmail.com +marcpiechura | Marc Piechura, piechura@gmx.net From b9fb096a3771c4f092b4c38c00bda74986f01e56 Mon Sep 17 00:00:00 2001 From: Chris Constantin Date: Wed, 19 Aug 2020 18:58:54 -0700 Subject: [PATCH 50/55] Signed relicensing doc Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Relicensing.txt b/Relicensing.txt index eca5076..a5344d8 100644 --- a/Relicensing.txt +++ b/Relicensing.txt @@ -7,3 +7,4 @@ github name | Real Name, Email Address used for git commits, Company viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. akarnokd | David Karnok, akarnokd@gmail.com marcpiechura | Marc Piechura, piechura@gmx.net +cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software Solutions Inc. From 5ec79c5caf898f6fe1946023c0b6065b9505a83a Mon Sep 17 00:00:00 2001 From: Alex Valuyskiy Date: Wed, 9 Sep 2020 22:15:20 +0300 Subject: [PATCH 51/55] Update Relicensing.txt Signed-off-by: Gregorius Soedharmo --- Relicensing.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Relicensing.txt b/Relicensing.txt index a5344d8..71d1ef0 100644 --- a/Relicensing.txt +++ b/Relicensing.txt @@ -8,3 +8,4 @@ viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend Inc. akarnokd | David Karnok, akarnokd@gmail.com marcpiechura | Marc Piechura, piechura@gmx.net cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software Solutions Inc. +alexvaluyskiy | Oleksii Valuiskyi, alex.valuiskyi@gmail.com From 2ff6255cbefe1773412b5079c4905a7c36dde683 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Thu, 29 Oct 2020 11:05:23 +0100 Subject: [PATCH 52/55] Port NUnit to XUnit, update target frameworks to netstandard2.0 and net461, update nuget package versions Author: Gregorius Soedharmo Signed-off-by: Gregorius Soedharmo --- CONTRIBUTING.md | 22 ++-- COPYING | 121 ------------------ CopyrightWaivers.txt | 25 ---- LICENSE | 11 +- README.md | 16 +-- src/SharedAssemblyInfo.cs | 2 +- src/api/Reactive.Streams/IProcessor.cs | 3 + src/api/Reactive.Streams/IPublisher.cs | 3 + src/api/Reactive.Streams/ISubscriber.cs | 5 +- src/api/Reactive.Streams/ISubscription.cs | 3 + .../Reactive.Streams/Reactive.Streams.csproj | 2 +- .../AsyncSubscriberTest.cs | 5 +- .../IterablePublisherTest.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../SyncSubscriberTest.cs | 5 +- .../SyncSubscriberWhiteboxTest.cs | 5 +- .../UnboundedIntegerIncrementPublisherTest.cs | 5 +- .../AsyncIterablePublisher.cs | 5 +- .../AsyncSubscriber.cs | 5 +- .../AtomicBoolean.cs | 5 +- .../IllegalStateException.cs | 5 +- .../InfiniteIncrementNumberPublisher.cs | 5 +- .../NumberIterablePublisher.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../SyncSubscriber.cs | 5 +- .../EmptyLazyPublisherTest.cs | 5 +- ...tityProcessorVerificationDelegationTest.cs | 5 +- .../IdentityProcessorVerificationTest.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../PublisherVerificationTest.cs | 5 +- .../RangePublisherTest.cs | 5 +- .../SingleElementPublisherTest.cs | 5 +- .../SubscriberBlackboxVerificationTest.cs | 5 +- .../SubscriberWhiteboxVerificationTest.cs | 5 +- .../Support/LamdaPublisher.cs | 5 +- .../Support/LamdaSubscriber.cs | 5 +- .../Support/LamdaSubscription.cs | 5 +- .../Support/SyncTriggeredDemandSubscriber.cs | 5 +- .../Support/TCKVerificationSupport.cs | 5 +- .../SyncTriggeredDemandSubscriberTest.cs | 5 +- ...ncTriggeredDemandSubscriberWhiteboxTest.cs | 5 +- .../IdentityProcessorVerification.cs | 5 +- .../Properties/AssemblyInfo.cs | 5 +- .../PublisherVerification.cs | 5 +- .../Reactive.Streams.TCK.csproj | 2 +- .../Reactive.Streams.TCK.nuspec | 2 +- .../SubscriberBlackboxVerification.cs | 5 +- .../SubscriberWhiteboxVerification.cs | 5 +- .../Support/AtomicBoolean.cs | 5 +- .../Support/AtomicCounter.cs | 5 +- .../Support/AtomicCounterLong.cs | 5 +- .../Support/AtomicReference.cs | 5 +- .../Support/HelperPublisher.cs | 5 +- .../Support/IPublisherVerificationRules .cs | 5 +- .../ISubscriberBlackboxVerificationRules.cs | 5 +- .../ISubscriberWhiteboxVerificationRules.cs | 5 +- .../Support/IllegalStateException.cs | 5 +- .../Support/InfiniteHelperPublisher.cs | 5 +- .../Reactive.Streams.TCK/Support/Option.cs | 5 +- .../SubscriberBufferOverflowException.cs | 5 +- .../Support/TestException.cs | 5 +- .../Reactive.Streams.TCK/TestEnvironment.cs | 5 +- .../WithHelperPublisher.cs | 5 +- 63 files changed, 231 insertions(+), 236 deletions(-) delete mode 100644 COPYING delete mode 100644 CopyrightWaivers.txt diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa61517..52380f1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,6 @@ # Contributing to the Reactive Streams Project -The Reactive Streams project welcomes contributions from anybody who wants to participate in moving this initiative forward. All code or documentation that is contributed will have to be covered by a waiver of all copyrights and other rights as detailed by the LICENSE and COPYING files at each repository root, the rationale for this is that the APIs defined by this project shall be freely implementable and usable by everyone. - -## Copyright Statement - -The aforementioned waiver of copyrights and other rights is represented by the addition of a line to the file [CopyrightWaivers.txt](https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/CopyrightWaivers.txt). For a pull request to be considered every contributor must have signed the copyright statement in this way; this may be included within that same pull request. +The Reactive Streams project welcomes contributions from anybody who wants to participate in moving this initiative forward. All code or documentation that is contributed will have to be covered by the **MIT No Attribution** (SPDX: MIT-0) license, the rationale for this is that the APIs defined by this project shall be freely implementable and usable by everyone. For more detail, see [LICENSE](https://github.com/reactive-streams/reactive-streams-jvm/blob/master/LICENSE). ## Gatekeepers @@ -28,16 +24,15 @@ Gatekeepers commit to the following: ## General Workflow -1. Make sure you have signed the Copyright Statement, see above. -2. Before starting to work on a change, make sure that: +1. Before starting to work on a change, make sure that: 1. There is a ticket for your work in the project's issue tracker. If not, create it first. It can help accelerating the pull request acceptance process if the change is agreed upon beforehand within the ticket, but in some cases it may be preferable to discuss the necessity of the change in consideration of a concrete proposal. 2. The ticket has been scheduled for the current milestone. -3. You should always perform your work in a Git feature branch within your own fork of the repository your are targeting (even if you should have push rights to the target repository). -4. When the change is completed you should open a [Pull Request](https://help.github.com/articles/using-pull-requests) on GitHub. -5. Anyone can comment on the pull request while it is open, and you are expected to answer questions or incorporate feedback. -6. Once at least two thirds of the gatekeepers have signaled their consent, the pull request is merged by one of the gatekeepers into the branch and repository it is targeting. Consent is signaled by commenting on the pull request with the text “LGTM”, and it suffices for one representative of a gatekeeper to signal consent for that gatekeeper to be counted towards the two thirds quorum. -7. It is not allowed to force-push to the branch on which the pull request is based. Replacing or adding to the commits on that branch will invalidate all previous consenting comments and consent needs to be re-established. -8. Before merging a branch that contains multiple commits, it is recommended that these are squashed into a single commit before performing the merge. To aid in verification that no new changes are introduced, a new pull request should be opened in this case, targeting the same branch and repository and containing just one commit which encompasses the full change set of the original pull request. +2. You should always perform your work in a Git feature branch within your own fork of the repository your are targeting (even if you should have push rights to the target repository). +3. When the change is completed you should open a [Pull Request](https://help.github.com/articles/using-pull-requests) on GitHub. +4. Anyone can comment on the pull request while it is open, and you are expected to answer questions or incorporate feedback. +5. Once at least two thirds of the gatekeepers have signaled their consent, the pull request is merged by one of the gatekeepers into the branch and repository it is targeting. Consent is signaled by commenting on the pull request with the text “LGTM”, and it suffices for one representative of a gatekeeper to signal consent for that gatekeeper to be counted towards the two thirds quorum. +6. It is not allowed to force-push to the branch on which the pull request is based. Replacing or adding to the commits on that branch will invalidate all previous consenting comments and consent needs to be re-established. +7. Before merging a branch that contains multiple commits, it is recommended that these are squashed into a single commit before performing the merge. To aid in verification that no new changes are introduced, a new pull request should be opened in this case, targeting the same branch and repository and containing just one commit which encompasses the full change set of the original pull request. ## Pull Request Requirements @@ -68,7 +63,6 @@ Example: * clarify how pull requests should look like * describe the acceptance process - * define the Copyright Statement signing process ## Performing Official Releases diff --git a/COPYING b/COPYING deleted file mode 100644 index 0e259d4..0000000 --- a/COPYING +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. diff --git a/CopyrightWaivers.txt b/CopyrightWaivers.txt deleted file mode 100644 index 8f28c68..0000000 --- a/CopyrightWaivers.txt +++ /dev/null @@ -1,25 +0,0 @@ -Copyright Statement for Contributions to the Reactive Streams Project -===================================================================== - -I hereby represent that all present, past and future contributions I make to -the Reactive Streams project (which includes all repositories owned by the -“reactive-streams” github organization) are governed by the Creative Commons -Zero 1.0 Universal copyright statement, placing my contributions in the public -domain. This entails that to the extent possible under law I waive all -copyright and related or neighboring rights to the code or documents I -contribute. I also represent that I have the authority to perform the above -waiver with respect to the entirety of my contributions. - -The text of the copyright statement is included in the COPYING file at the root -of the reactive-streams repository at -https://github.com/reactive-streams/reactive-streams-dotnet/blob/master/COPYING. - -Underwriting parties: - -github name | Real Name, Email Address used for git commits, Company ----------------+---------------------------------------------------------------------------- -cconstantin | Chris Constantin, chris.constantin@aligned.io, Aligned Software Solutions, Inc. -viktorklang | Viktor Klang, viktor.klang@gmail.com, Lightbend, Inc. -Silv3rcircl3 | Marc Piechura, piechura@gmx.net, Pulmokard GmbH -alexvaluyskiy | Alex Valuyskiy, alex.valuiskyi@gmail.com -akarnokd | David Karnok, akarnokd@gmail.com diff --git a/LICENSE b/LICENSE index 696f2c0..1e141c1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,7 @@ -Licensed under Public Domain (CC0) +MIT No Attribution -To the extent possible under law, the person who associated CC0 with -this code has waived all copyright and related or neighboring -rights to this code. +Copyright 2014 Reactive Streams -You should have received a copy of the CC0 legalcode along with this -work. If not, see . +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 4f8d7b2..9964ee5 100644 --- a/README.md +++ b/README.md @@ -229,18 +229,4 @@ ISubscribers signaling a demand for one element after the reception of an elemen ## Legal -This project is a collaboration between engineers from Kaazing, Netflix, Pivotal, Red Hat, Twitter, Typesafe and many others. The code is offered to the Public Domain in order to allow free use by interested parties who want to create compatible implementations. For details see `COPYING`. - -

- - CC0 - -
- To the extent possible under law, - - Reactive Streams Special Interest Group - has waived all copyright and related or neighboring rights to - Reactive Streams .NET. - This work is published from: - United States. -

+This project is a collaboration between engineers from Kaazing, Lightbend, Netflix, Pivotal, Red Hat, Twitter and many others. This project is licensed under MIT No Attribution (SPDX: MIT-0). diff --git a/src/SharedAssemblyInfo.cs b/src/SharedAssemblyInfo.cs index d7781d0..84d1f3a 100644 --- a/src/SharedAssemblyInfo.cs +++ b/src/SharedAssemblyInfo.cs @@ -2,7 +2,7 @@ using System.Reflection; [assembly: AssemblyCompanyAttribute("Reactive Streams")] -[assembly: AssemblyCopyrightAttribute("CC0 1.0 Universal")] +[assembly: AssemblyCopyrightAttribute("MIT-0")] [assembly: AssemblyTrademarkAttribute("")] [assembly: AssemblyVersionAttribute("1.0.0.0")] [assembly: AssemblyFileVersionAttribute("1.0.0.0")] diff --git a/src/api/Reactive.Streams/IProcessor.cs b/src/api/Reactive.Streams/IProcessor.cs index c01bb38..901c2d2 100644 --- a/src/api/Reactive.Streams/IProcessor.cs +++ b/src/api/Reactive.Streams/IProcessor.cs @@ -1,3 +1,6 @@ +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ namespace Reactive.Streams { /// diff --git a/src/api/Reactive.Streams/IPublisher.cs b/src/api/Reactive.Streams/IPublisher.cs index 078dd91..41c7b12 100644 --- a/src/api/Reactive.Streams/IPublisher.cs +++ b/src/api/Reactive.Streams/IPublisher.cs @@ -1,3 +1,6 @@ +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ namespace Reactive.Streams { /// diff --git a/src/api/Reactive.Streams/ISubscriber.cs b/src/api/Reactive.Streams/ISubscriber.cs index dfe6bd4..289ee23 100644 --- a/src/api/Reactive.Streams/ISubscriber.cs +++ b/src/api/Reactive.Streams/ISubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ + using System; namespace Reactive.Streams { diff --git a/src/api/Reactive.Streams/ISubscription.cs b/src/api/Reactive.Streams/ISubscription.cs index 2400c76..392b594 100644 --- a/src/api/Reactive.Streams/ISubscription.cs +++ b/src/api/Reactive.Streams/ISubscription.cs @@ -1,3 +1,6 @@ +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ namespace Reactive.Streams { /// diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index 0f1fb51..10efc1c 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -3,7 +3,7 @@ Reactive.Streams Reactive Streams API - CC0 1.0 Universal + MIT-0 1.0.3 Reactive Streams netstandard2.0;net452 diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs index f674553..dbfd078 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/AsyncSubscriberTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Threading; using Xunit; using Xunit.Abstractions; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs index 77804a8..a2d97a9 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/IterablePublisherTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Xunit; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs index 0e760c9..f76b21a 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs index cac58cd..087bdfe 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs index 54c65f2..23df0ba 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/SyncSubscriberWhiteboxTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK; diff --git a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs index 6eab2f6..e4da786 100644 --- a/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs +++ b/src/examples/Reactive.Streams.Example.Unicast.Tests/UnboundedIntegerIncrementPublisherTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Xunit; diff --git a/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs b/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs index 2564b2c..37d8fc3 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/AsyncIterablePublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading.Tasks; diff --git a/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs b/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs index 41d7110..6c3ec77 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/AsyncSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Concurrent; using System.Threading.Tasks; diff --git a/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs b/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs index f721e60..85b88a7 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/AtomicBoolean.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.Example.Unicast { diff --git a/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs b/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs index 1de87bd..1ec291c 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/IllegalStateException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.Example.Unicast { diff --git a/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs b/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs index 6bbdd11..e825109 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/InfiniteIncrementNumberPublisher.cs @@ -1,4 +1,7 @@ -using System.Collections; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Collections; using System.Collections.Generic; namespace Reactive.Streams.Example.Unicast diff --git a/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs b/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs index a237408..aedbfad 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/NumberIterablePublisher.cs @@ -1,4 +1,7 @@ -using System.Linq; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Linq; namespace Reactive.Streams.Example.Unicast { diff --git a/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs b/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs index 9367989..4bad06d 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden diff --git a/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs b/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs index b5ac19a..710a649 100644 --- a/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs +++ b/src/examples/Reactive.Streams.Example.Unicast/SyncSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.Example.Unicast { diff --git a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs index 5405913..68b7f92 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/EmptyLazyPublisherTest.cs @@ -1,4 +1,7 @@ -using System.Linq; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System.Linq; using Xunit; using Xunit.Abstractions; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs index 16a55f7..d724f11 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationDelegationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; diff --git a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs index f069039..d53b911 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/IdentityProcessorVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs b/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs index e0bab10..2f364b2 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // Allgemeine Informationen über eine Assembly werden über die folgenden diff --git a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs index 3a8d808..e9fa67f 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/PublisherVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Threading; using System.Threading.Tasks; using Xunit; diff --git a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs index 426fa87..cf5d416 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/RangePublisherTest.cs @@ -1,4 +1,7 @@ -using Xunit; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using Xunit; using Xunit.Abstractions; using System; using System.Collections.Concurrent; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs index c67eb51..0862005 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SingleElementPublisherTest.cs @@ -1,4 +1,7 @@ -using System.Linq; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System.Linq; using Xunit; using Xunit.Abstractions; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs index a1d376e..b777b4b 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberBlackboxVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs index efbd695..e079c3c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SubscriberWhiteboxVerificationTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Runtime.CompilerServices; using Xunit; using Xunit.Abstractions; diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs index 32b7d2b..354e9b2 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaPublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Tests.Support { diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs index 6daa2dc..dc30c64 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Runtime.CompilerServices; namespace Reactive.Streams.TCK.Tests.Support diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs index de46a57..c94c113 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/LamdaSubscription.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Tests.Support { diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs index 23dcc40..b30cfa8 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/SyncTriggeredDemandSubscriber.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK.Tests.Support diff --git a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs index ac715c4..28986e0 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/Support/TCKVerificationSupport.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs index 23ea52b..0e7dd7c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberTest.cs @@ -1,4 +1,7 @@ -using Xunit; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs index df5d9a4..9b00c1c 100644 --- a/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs +++ b/src/tck/Reactive.Streams.TCK.Tests/SyncTriggeredDemandSubscriberWhiteboxTest.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** +* Licensed under MIT No Attribution (SPDX: MIT-0) * +***************************************************/ +using System; using Xunit; using Xunit.Abstractions; using Reactive.Streams.TCK.Tests.Support; diff --git a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs index 9c59240..1cd0366 100644 --- a/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs +++ b/src/tck/Reactive.Streams.TCK/IdentityProcessorVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Generic; using Xunit; using Xunit.Abstractions; diff --git a/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs b/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs index 09d6cae..a0e01b3 100644 --- a/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs +++ b/src/tck/Reactive.Streams.TCK/Properties/AssemblyInfo.cs @@ -1,4 +1,7 @@ -using System.Reflection; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs index 398967c..3e0e3db 100644 --- a/src/tck/Reactive.Streams.TCK/PublisherVerification.cs +++ b/src/tck/Reactive.Streams.TCK/PublisherVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Generic; using System.Threading; using FluentAssertions; diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 36cf106..b2dabfb 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj @@ -3,7 +3,7 @@ Reactive.Streams.TCK Reactive Streams Technology Compatibility Kit - CC0 1.0 Universal + MIT-0 1.0.3 Reactive Streams net452;netstandard2.0 diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec index 80146ca..611f4ca 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.nuspec @@ -9,7 +9,7 @@ http://creativecommons.org/publicdomain/zero/1.0/ https://github.com/reactive-streams/reactive-streams-dotnet Reactive Streams Technology Compatibility Kit - CC0 1.0 Universal + MIT-0 reactive stream diff --git a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs index 2312215..05ca09b 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberBlackboxVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Diagnostics; using System.Linq; using Xunit; diff --git a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs index bb078c5..ce8cc72 100644 --- a/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs +++ b/src/tck/Reactive.Streams.TCK/SubscriberWhiteboxVerification.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Diagnostics; using System.Linq; using Xunit; diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs index 6d8c8d7..91d1c37 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicBoolean.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs index 5eb1b96..edc5911 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicCounter.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs index 7450795..ee5638b 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicCounterLong.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs b/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs index 93049f0..4dd3ab9 100644 --- a/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs +++ b/src/tck/Reactive.Streams.TCK/Support/AtomicReference.cs @@ -1,4 +1,7 @@ -using System.Threading; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Threading; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs b/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs index 79f49e9..a1d670f 100644 --- a/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs +++ b/src/tck/Reactive.Streams.TCK/Support/HelperPublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs b/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs index 7a64136..b6a9a75 100644 --- a/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs +++ b/src/tck/Reactive.Streams.TCK/Support/IPublisherVerificationRules .cs @@ -1,4 +1,7 @@ -namespace Reactive.Streams.TCK.Support +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +namespace Reactive.Streams.TCK.Support { /// /// Internal TCK use only. diff --git a/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs b/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs index e539827..f3d713f 100644 --- a/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs +++ b/src/tck/Reactive.Streams.TCK/Support/ISubscriberBlackboxVerificationRules.cs @@ -1,4 +1,7 @@ -namespace Reactive.Streams.TCK.Support +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +namespace Reactive.Streams.TCK.Support { /// /// Internal TCK use only. diff --git a/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs b/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs index 1d95c28..a26d6d0 100644 --- a/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs +++ b/src/tck/Reactive.Streams.TCK/Support/ISubscriberWhiteboxVerificationRules.cs @@ -1,4 +1,7 @@ -namespace Reactive.Streams.TCK.Support +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +namespace Reactive.Streams.TCK.Support { /// /// Internal TCK use only. diff --git a/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs b/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs index 4229e8f..1dbda5a 100644 --- a/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs +++ b/src/tck/Reactive.Streams.TCK/Support/IllegalStateException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs b/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs index b66e7b4..e278ce4 100644 --- a/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs +++ b/src/tck/Reactive.Streams.TCK/Support/InfiniteHelperPublisher.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections; using System.Collections.Generic; using Reactive.Streams.Example.Unicast; diff --git a/src/tck/Reactive.Streams.TCK/Support/Option.cs b/src/tck/Reactive.Streams.TCK/Support/Option.cs index 2aa6164..00e4b91 100644 --- a/src/tck/Reactive.Streams.TCK/Support/Option.cs +++ b/src/tck/Reactive.Streams.TCK/Support/Option.cs @@ -1,4 +1,7 @@ -using System.Collections.Generic; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System.Collections.Generic; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs b/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs index 4959db8..608ec5f 100644 --- a/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs +++ b/src/tck/Reactive.Streams.TCK/Support/SubscriberBufferOverflowException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/Support/TestException.cs b/src/tck/Reactive.Streams.TCK/Support/TestException.cs index 61223de..7f073b2 100644 --- a/src/tck/Reactive.Streams.TCK/Support/TestException.cs +++ b/src/tck/Reactive.Streams.TCK/Support/TestException.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; namespace Reactive.Streams.TCK.Support { diff --git a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs index ff6b661..e1f8362 100644 --- a/src/tck/Reactive.Streams.TCK/TestEnvironment.cs +++ b/src/tck/Reactive.Streams.TCK/TestEnvironment.cs @@ -1,4 +1,7 @@ -using System; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading; diff --git a/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs b/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs index 5ae4f6d..15c6d1f 100644 --- a/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs +++ b/src/tck/Reactive.Streams.TCK/WithHelperPublisher.cs @@ -1,4 +1,7 @@ -using Reactive.Streams.TCK.Support; +/*************************************************** + * Licensed under MIT No Attribution (SPDX: MIT-0) * + ***************************************************/ +using Reactive.Streams.TCK.Support; namespace Reactive.Streams.TCK { From 68ef99a20489890dde9b4479c0585f3401575517 Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Mon, 17 May 2021 23:50:50 +0700 Subject: [PATCH 53/55] Update framework targets and package versions Signed-off-by: Gregorius Soedharmo --- src/api/Reactive.Streams/Reactive.Streams.csproj | 2 +- .../Reactive.Streams.Example.Unicast.Tests.csproj | 5 ++++- .../Reactive.Streams.Example.Unicast.csproj | 2 +- .../Reactive.Streams.TCK.Tests.csproj | 5 ++++- src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index 10efc1c..a4ba3d3 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -6,7 +6,7 @@ MIT-0 1.0.3 Reactive Streams - netstandard2.0;net452 + netstandard2.0;net461 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ 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 f0b48d9..0806159 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 @@ -15,7 +15,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + 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 f7f1b36..cc2efe4 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 - netstandard2.0;net452 + netstandard2.0;net461 true 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 d61df44..bcab5ee 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 @@ -15,7 +15,10 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index b2dabfb..6748f93 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 - net452;netstandard2.0 + net461;netstandard2.0 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ From b45555b0758144751a2aa0eaea9157c9d161b05d Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Fri, 21 Aug 2020 19:44:51 +0700 Subject: [PATCH 54/55] Add xunit and Xunit.SkippableFact, replace [Test] with [SkippableFact] --- src/api/Reactive.Streams/Reactive.Streams.csproj | 1 + .../Reactive.Streams.Example.Unicast.Tests.csproj | 2 ++ .../Reactive.Streams.Example.Unicast.csproj | 1 + .../Reactive.Streams.TCK.Tests.csproj | 1 + src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj | 1 + 5 files changed, 6 insertions(+) diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index a4ba3d3..b87ce5b 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -7,6 +7,7 @@ 1.0.3 Reactive Streams netstandard2.0;net461 + netstandard2.0;net452 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ 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 0806159..2e05d93 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 @@ -2,6 +2,7 @@ Reactive.Streams.Example.Unicast.Tests net461;netcoreapp3.1 + net461 win7-x64 @@ -19,6 +20,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + 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 cc2efe4..a643dd9 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 @@ -3,6 +3,7 @@ Reactive.Streams.Example.Unicast netstandard2.0;net461 + netstandard2.0;net452 true 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 bcab5ee..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 @@ -19,6 +19,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 6748f93..8863fb4 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj @@ -7,6 +7,7 @@ 1.0.3 Reactive Streams net461;netstandard2.0 + net452;netstandard2.0 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ From 16412fd3a12d57b227def8e53d4dc8ca1f58326b Mon Sep 17 00:00:00 2001 From: Gregorius Soedharmo Date: Tue, 18 May 2021 01:11:20 +0700 Subject: [PATCH 55/55] Update target frameworks --- src/api/Reactive.Streams/Reactive.Streams.csproj | 3 +-- .../Reactive.Streams.Example.Unicast.Tests.csproj | 1 - .../Reactive.Streams.Example.Unicast.csproj | 3 +-- src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj | 3 +-- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/api/Reactive.Streams/Reactive.Streams.csproj b/src/api/Reactive.Streams/Reactive.Streams.csproj index b87ce5b..b2b2a7f 100644 --- a/src/api/Reactive.Streams/Reactive.Streams.csproj +++ b/src/api/Reactive.Streams/Reactive.Streams.csproj @@ -6,8 +6,7 @@ MIT-0 1.0.3 Reactive Streams - netstandard2.0;net461 - netstandard2.0;net452 + netstandard2.0 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/ 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 2e05d93..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 @@ -2,7 +2,6 @@ Reactive.Streams.Example.Unicast.Tests net461;netcoreapp3.1 - net461 win7-x64 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 a643dd9..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,8 +2,7 @@ Reactive.Streams.Example.Unicast - netstandard2.0;net461 - netstandard2.0;net452 + netstandard2.0 true diff --git a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj index 8863fb4..3cb403e 100644 --- a/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj +++ b/src/tck/Reactive.Streams.TCK/Reactive.Streams.TCK.csproj @@ -6,8 +6,7 @@ MIT-0 1.0.3 Reactive Streams - net461;netstandard2.0 - net452;netstandard2.0 + netstandard2.0 reactive;stream https://github.com/reactive-streams/reactive-streams-dotnet http://creativecommons.org/publicdomain/zero/1.0/