Esempio n. 1
0
        private SpecificationEngine buildBatchedEngine(string tracingStyle)
        {
            IBatchObserver     batchObserver     = new BatchObserver();
            IExecutionObserver executionObserver = new NulloObserver();

            if ("TeamCity" == tracingStyle)
            {
                batchObserver     = new TeamCityBatchObserver(batchObserver);
                executionObserver = new TeamCityExecutionObserver();
            }

            var executionMode = new BatchExecutionMode(batchObserver);
            var runner        = new SpecRunner(executionMode, _system, _specExpiration);

            var engine = new SpecificationEngine(
                _system, runner, executionObserver);

            _controller = new BatchController(engine, batchObserver);

            _services.Add(engine);

            EventAggregator.Messaging.AddListener(_controller);

            return(engine);
        }
Esempio n. 2
0
        /// <summary>
        /// The batch-oriented stream subscription using weakly-typed delegate.
        /// </summary>
        /// <param name="callback">Callback delegate to receive stream pushes in batches.</param>
        /// <returns>
        /// A promise for a StreamSubscription that represents the subscription.
        /// The consumer may unsubscribe by using this object.
        /// The subscription remains active for as long as it is not explicitly unsubscribed.
        /// </returns>
        public virtual async Task <StreamSubscription> Subscribe(Func <object[], Task> callback)
        {
            Requires.NotNull(callback, nameof(callback));

            var observer = new BatchObserver(callback);
            var handle   = await Endpoint.SubscribeAsync(observer);

            return(new StreamSubscription(handle));
        }
Esempio n. 3
0
        private SpecificationEngine buildBatchedEngine(string tracingStyle)
        {
            IBatchObserver batchObserver = new BatchObserver();
            IExecutionObserver executionObserver = new NulloObserver();

            if ("TeamCity" == tracingStyle)
            {
                batchObserver = new TeamCityBatchObserver(batchObserver);
                executionObserver = new TeamCityExecutionObserver();
            }

            var executionMode = new BatchExecutionMode(batchObserver);
            var runner = new SpecRunner(executionMode, _system, _specExpiration);

            var engine = new SpecificationEngine(
                _system, runner, executionObserver);

            _controller = new BatchController(engine, batchObserver);

            _services.Add(engine);

            EventAggregator.Messaging.AddListener(_controller);

            return engine;
        }