public void ThenResolverGetsDefaultAction()
            {
                // Arrange
                var pmode = new SendingProcessingMode();

                // Act
                string action = SendingPModeMap.ResolveAction(pmode);

                // Assert
                Assert.Equal(Constants.Namespaces.TestAction, action);
            }
            public void ThenResolverGetsAction()
            {
                // Arrange
                var pmode = new SendingProcessingMode
                {
                    MessagePackaging = { CollaborationInfo = new AS4.Model.PMode.CollaborationInfo {
                                             Action        = "action"
                                         } }
                };

                // Act
                string action = SendingPModeMap.ResolveAction(pmode);

                // Assert
                Assert.Equal(pmode.MessagePackaging.CollaborationInfo.Action, action);
            }
Beispiel #3
0
        private static string ResolveAction(SubmitMessage submit, SendingProcessingMode sendingPMode)
        {
            string submitAction = submit?.Collaboration?.Action;
            string pmodeAction  = sendingPMode?.MessagePackaging?.CollaborationInfo?.Action;

            if (sendingPMode?.AllowOverride == false &&
                !String.IsNullOrEmpty(submitAction) &&
                !String.IsNullOrEmpty(pmodeAction) &&
                !StringComparer.OrdinalIgnoreCase.Equals(submitAction, pmodeAction))
            {
                throw new NotSupportedException(
                          $"SubmitMessage is not allowed by SendingPMode {sendingPMode.Id} to override Action");
            }

            if (!String.IsNullOrEmpty(submitAction))
            {
                return(submit.Collaboration.Action);
            }

            return(SendingPModeMap.ResolveAction(sendingPMode));
        }