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); }
private static async Task <MessagingContext> ExerciseTransform(ReceivedMessage msg) { const string pmodeId = "pmode-id"; var stubConfig = new StubConfig( new Dictionary <string, SendingProcessingMode> { [pmodeId] = new SendingProcessingMode() }, new Dictionary <string, ReceivingProcessingMode>()); var sut = new SubmitPayloadTransformer(stubConfig); sut.Configure(new Dictionary <string, string> { ["SendingPMode"] = pmodeId }); return(await sut.TransformAsync(msg)); }
public void StartReceiver() { var stubConfig = new StubConfig( sendingPModes: new Dictionary <string, SendingProcessingMode> { ["01-send"] = AS4XmlSerializer.FromString <SendingProcessingMode>(Properties.Resources.send_01) }, receivingPModes: new Dictionary <string, ReceivingProcessingMode> { ["01-receive"] = AS4XmlSerializer.FromString <ReceivingProcessingMode>(Properties.Resources.receive_01) }); // Arrange var receiver = new PullRequestReceiver(stubConfig); Setting receiverSetting = CreateMockReceiverSetting(); receiver.Configure(new[] { receiverSetting }); // Act receiver.StartReceiving(OnMessageReceived, CancellationToken.None); // Assert Assert.True(_waitHandle.WaitOne(timeout: TimeSpan.FromMinutes(2))); }