Пример #1
0
        Required_spec205_blackbox_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal
            ()
        {
            var stage = new BlackBoxTestStage <T>(Environment, this);
            // try to subscribe another time, if the subscriber calls `probe.RegisterOnSubscribe` the test will fail
            var secondSubscriptionCancelled = new Latch(Environment);

            stage.Sub.OnSubscribe(new Spec205Subscription(Environment, secondSubscriptionCancelled, stage.Sub));
            secondSubscriptionCancelled.ExpectClose(
                "Expected SecondSubscription given to subscriber to be cancelled, but `Subscription.cancel()` was not called.");
            Environment.VerifyNoAsyncErrorsNoDelay();
        }
Пример #2
0
        public void Required_spec205_mustCallSubscriptionCancelIfItAlreadyHasAnSubscriptionAndReceivesAnotherOnSubscribeSignal()
        => SubscriberTest(stage =>
        {
            // try to subscribe another time, if the subscriber calls `probe.RegisterOnSubscribe` the test will fail
            var secondSubscriptionCancelled = new Latch(_environment);
            var subscriber   = stage.Sub;
            var subscription = new Spec205Subscription(secondSubscriptionCancelled);

            subscriber.OnSubscribe(subscription);

            secondSubscriptionCancelled.ExpectClose(
                "Expected 2nd Subscription given to subscriber to be cancelled, but `Subscription.cancel()` was not called");
            _environment.VerifyNoAsyncErrors();
        });