示例#1
0
            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);
            }
示例#2
0
            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));
            }
示例#3
0
            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));
            }