public async Task SendingPModeCorrectlyDetermined() { const string sendingPModeId = "Forward_SendingPMode_Id"; var receivingPMode = new ReceivingProcessingMode() { MessageHandling = new MessageHandling() { Item = new AS4.Model.PMode.Forward() { SendingPMode = sendingPModeId } } }; var config = new StubConfig(sendingPModes: new Dictionary <string, SendingProcessingMode>() { { sendingPModeId, new SendingProcessingMode() { Id = sendingPModeId } } }, receivingPModes: new Dictionary <string, ReceivingProcessingMode>()); var context = new MessagingContext(new ReceivedMessage(Stream.Null), MessagingContextMode.Forward) { ReceivingPMode = receivingPMode }; var sut = new DetermineRoutingStep(config); var result = await sut.ExecuteAsync(context); Assert.True(result.Succeeded); Assert.NotNull(result.MessagingContext.SendingPMode); }
public async Task ExceptionWhenNoReceivingPModeAvailable() { var messagingContext = new MessagingContext(new ReceivedMessage(Stream.Null), MessagingContextMode.Forward) { ReceivingPMode = null }; var step = new DetermineRoutingStep(StubConfig.Default); await Assert.ThrowsAsync <InvalidOperationException>(() => step.ExecuteAsync(messagingContext)); }
public async Task ExceptionWhenReceivingPModeIsInvalid() { var receivingPMode = new ReceivingProcessingMode() { MessageHandling = new MessageHandling() { Item = new AS4.Model.PMode.Deliver() } }; var messagingContext = new MessagingContext(new ReceivedMessage(Stream.Null), MessagingContextMode.Forward) { ReceivingPMode = receivingPMode }; var step = new DetermineRoutingStep(StubConfig.Default); await Assert.ThrowsAsync <ConfigurationErrorsException>(() => step.ExecuteAsync(messagingContext)); }