コード例 #1
0
            public void ThenResolverGetsDefaultAction()
            {
                // Arrange
                var pmode = new SendingProcessingMode();

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

                // Assert
                Assert.Equal(Constants.Namespaces.TestAction, action);
            }
コード例 #2
0
            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);
            }
コード例 #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));
        }