public void ShouldExposePipelineConfiguration() { var pipelineConfiguration = A.Fake <IHavePipelineConfiguration>(); var testee = new IncommingEnvelopeContext(A.Fake <Envelope>(), pipelineConfiguration); testee.Configuration.Should().Be(pipelineConfiguration); }
public void IsPipelineContext() { var testee = new IncommingEnvelopeContext( A.Fake <Envelope>(), A.Fake <IHavePipelineConfiguration>()); testee.Should().BeAssignableTo <PipelineContext>(); }
private Task InvokeIncommingEnvelopeStepsAsync(IncommingEnvelopeContext context) { if (!this.incommingEnvelopeSteps.Any()) { return(Task.CompletedTask); } var nextStep = this.incommingEnvelopeSteps.Dequeue(); return(nextStep.InvokeAsync(context, () => this.InvokeIncommingEnvelopeStepsAsync(context))); }
public void CanSetMessage() { var message = new ValueCommand(11); var envelope = Envelope.Create(new EndpointAddress("sender"), new EndpointAddress("recipient"), message); var pipelineConfiguration = A.Fake <IHavePipelineConfiguration>(); var testee = new IncommingEnvelopeContext(envelope, pipelineConfiguration); testee.SetMessage(); testee.Message.Should().Be(message); }
/// <summary> /// Invokes the pipeline /// </summary> /// <param name="envelope">The envelope</param> public async Task InvokeAsync(Envelope envelope) { var envelopeContext = new IncommingEnvelopeContext(envelope, this.configuration); await this.InvokeIncommingEnvelopeStepsAsync(envelopeContext).ConfigureAwait(false); if (envelopeContext.Message == null) { return; } var messageContext = new IncommingMessageContext( envelopeContext.Message, envelopeContext.Envelope.Headers, this.configuration); await this.InvokeIncommingMessageStepsAsync(messageContext).ConfigureAwait(false); }
/// <inheritdoc /> public override Task InvokeAsync(IncommingEnvelopeContext context, Func <Task> next) { context.SetMessage(); return(Task.CompletedTask); }