public void Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnError_shouldFail_dueToCallingCancel() { ISubscription subscription = null; var subscriber = new LamdaSubscriber <int?>(onSubscribe: sub => subscription = sub, onError: _ => subscription.Cancel()); var verification = CustomSubscriberVerification(subscriber); RequireTestFailure(() => verification.Required_spec203_blackbox_mustNotCallMethodsOnSubscriptionOrPublisherInOnError(), "Subscription.Cancel MUST NOT be called from Subscriber.OnError (Rule 2.3)!"); }
public void Required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall_shouldFail() { var subscriber = new LamdaSubscriber <int?>(onError: cause => { // this is wrong in many ways (incl. spec violation), but aims to simulate user code which "blows up" when handling the onError signal throw new Exception("Wrong, don't do this!", cause); // don't do this }); var verification = CustomSubscriberVerification(subscriber); RequireTestFailure(() => verification.Required_spec210_blackbox_mustBePreparedToReceiveAnOnErrorSignalWithPrecedingRequestCall(), "Test Exception: Boom!"); // checks that the expected exception was delivered to onError, we don't expect anyone to implement onError so weirdly }
public void Required_spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal_shouldFail() { ISubscription subscription = null; var subscriber = new LamdaSubscriber <int?>(onSubscribe: sub => { subscription = sub; sub.Request(1); // this is wrong, as one should always check if should accept or reject the subscription }); var verification = CustomSubscriberVerification(subscriber); RequireTestFailure(() => verification.Required_spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal(), "illegally called `Subscription.Request(1)`"); }