Beispiel #1
0
        public void ShouldExposeEnvelope()
        {
            var envelope = A.Fake <Envelope>();
            var testee   = new OutgoingEnvelopeContext(envelope, A.Fake <IHavePipelineConfiguration>());

            testee.Envelope.Should().Be(envelope);
        }
Beispiel #2
0
        public void ShouldExposePipelineConfiguration()
        {
            var pipelineConfiguration = A.Fake <IHavePipelineConfiguration>();
            var testee = new OutgoingEnvelopeContext(A.Fake <Envelope>(), pipelineConfiguration);

            testee.Configuration.Should().Be(pipelineConfiguration);
        }
Beispiel #3
0
        public void IsPipelineContext()
        {
            var testee = new OutgoingEnvelopeContext(
                A.Fake <Envelope>(),
                A.Fake <IHavePipelineConfiguration>());

            testee.Should().BeAssignableTo <PipelineContext>();
        }
        /// <inheritdoc />
        public override Task InvokeAsync(OutgoingEnvelopeContext context, Func <Task> next)
        {
            Logger.InfoFormat(
                "Sending {0} of type {1} to {2}",
                context.Envelope.Body.GetIntent(),
                context.Envelope.Body.GetFullName(),
                context.Envelope.Headers[HeaderKeys.Recipient]);

            return(this.handleEnvelopeAsync(context.Envelope));
        }
        private Task InvokeOutgoingEnvelopeStepsAsync(OutgoingEnvelopeContext context)
        {
            if (!this.outgoingEnvelopeSteps.Any())
            {
                return(Task.CompletedTask);
            }

            var nextStep = this.outgoingEnvelopeSteps.Dequeue();

            return(nextStep.InvokeAsync(context, () => this.InvokeOutgoingEnvelopeStepsAsync(context)));
        }
        public FinalOutgoingEnvelopeStepTest()
        {
            Trace.Listeners.Add(InMemoryTraceListener.Instance);

            var headers = new Dictionary <string, object> {
                { HeaderKeys.Recipient, "recipient" }
            };
            var body          = new MyCommand();
            var envelope      = new Envelope(headers, body);
            var configuration = A.Fake <IHavePipelineConfiguration>();

            this.outgoingEnvelopeContext = new OutgoingEnvelopeContext(envelope, configuration);
            this.finalActionForEnvelope  = A.Fake <Func <Envelope, Task> >();
            this.testee = new FinalOutgoingEnvelopeStep(this.finalActionForEnvelope);
        }
 public override Task InvokeAsync(OutgoingEnvelopeContext context, Func <Task> next)
 {
     this.HasBeenCalled = true;
     return(Task.CompletedTask);
 }