예제 #1
0
 public ManualPublisher(TestEnvironment environment)
 {
     Environment = environment;
     Requests    = new Receptacle <long>(environment);
     Cancelled   = new Latch(environment);
     Subscriber  = new Promise <ISubscriber <T> >(environment);
 }
예제 #2
0
 public Spec205Subscription(TestEnvironment environment, Latch secondSubscriptionCancelled,
                            ISubscriber <T> subscriber)
 {
     _environment = environment;
     _secondSubscriptionCancelled = secondSubscriptionCancelled;
     _subscriber = subscriber;
 }
예제 #3
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();
        }
예제 #4
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();
        });
예제 #5
0
 public Receptacle(TestEnvironment environment)
 {
     _environment    = environment;
     _completedLatch = new Latch(environment);
 }
예제 #6
0
 public Spec205Subscription(Latch secondSubscriptionCancelled)
 {
     _secondSubscriptionCancelled = secondSubscriptionCancelled;
 }