////////////////////// SUBSCRIBER RULES VERIFICATION ///////////////////////////
        // Verifies rule: https://github.com/reactive-streams/reactive-streams-jvm#4.1

        // A Processor
        //   must obey all Subscriber rules on its consuming side
        public ISubscriber <T> CreateSubscriber(WhiteboxSubscriberProbe <T> probe)
        {
            var processor = CreateIdentityProcessor(_processorBufferSize);

            processor.Subscribe(new ProcessorSubscriber(_environment, probe));
            return(processor); // we run the SubscriberVerification against this
        }
示例#2
0
 public WhiteboxTestStage(TestEnvironment environment, SubscriberWhiteboxVerification <T> verification, bool runDefaultInit = true) : base(environment)
 {
     _verification = verification;
     if (runDefaultInit)
     {
         Publisher = CreateHelperPublisher(long.MaxValue);
         Tees      = Environment.NewManualSubscriber(Publisher);
         Probe     = new WhiteboxSubscriberProbe <T>(Environment, Subscriber);
         Subscribe(verification.CreateSubscriber(Probe));
         Probe.Puppet.ExpectCompletion(environment.DefaultTimeoutMilliseconds,
                                       $"Subscriber {Sub} did not call `RegisterOnSubscribe`");
     }
 }
 public ProcessorSubscriber(TestEnvironment environment, WhiteboxSubscriberProbe <T> probe)
 {
     _environment  = environment;
     _probe        = probe;
     _subscription = new Promise <ISubscription>(environment);
 }
 public override ISubscriber <T> CreateSubscriber(WhiteboxSubscriberProbe <T> probe)
 => _processor.CreateSubscriber(probe);
示例#5
0
        // USER API

        /// <summary>
        /// This is the main method you must implement in your test incarnation.
        /// It must create a new <see cref="ISubscriber{T}"/> instance to be subjected to the testing logic.
        ///
        /// In order to be meaningfully testable your Subscriber must inform the given
        /// `WhiteboxSubscriberProbe` of the respective events having been received.
        /// </summary>
        public abstract ISubscriber <T> CreateSubscriber(WhiteboxSubscriberProbe <T> probe);