private void ArrangePModeThenAgreementRefIsNotEnough(AS4.Model.PMode.AgreementReference agreementRef)
            {
                ReceivePMode pmode = CreatePModeWithAgreementRef(agreementRef);

                DifferentiatePartyInfo(pmode);
                SetupPModes(pmode, new ReceivePMode());
            }
        protected ReceivePMode CreatePModeWithAgreementRef(AS4.Model.PMode.AgreementReference agreementRef)
        {
            ReceivePMode pmode = CreateDefaultPMode("defaultPMode");

            pmode.MessagePackaging.CollaborationInfo.AgreementReference = agreementRef;

            return(pmode);
        }
        protected ReceivePMode CreatePModeWithActionService(string service, string action)
        {
            ReceivePMode pmode = CreateDefaultPMode("defaultPMode");

            pmode.MessagePackaging.CollaborationInfo.Action        = action;
            pmode.MessagePackaging.CollaborationInfo.Service.Value = service;

            return(pmode);
        }
            private void ArrangePModeThenServiceAndActionIsNotEnough(string action, string service)
            {
                ReceivePMode pmode = CreatePModeWithActionService(service, action);

                pmode.MessagePackaging.CollaborationInfo.AgreementReference.Value = "not-equal";
                DifferentiatePartyInfo(pmode);
                SetupPModes(pmode, new ReceivePMode()
                {
                    Id = "other id"
                });
            }
        private static void DifferentiatePartyInfo(ReceivePMode pmode)
        {
            const string fromId = "from-Id";
            const string toId   = "to-Id";

            var fromParty = new Party {
                Role = fromId, PartyIds = { new PartyId {
                                                Id = fromId
                                            } }
            };
            var toParty = new Party {
                Role = toId, PartyIds = { new PartyId {
                                              Id = toId
                                          } }
            };

            pmode.MessagePackaging.PartyInfo = new PartyInfo {
                FromParty = fromParty, ToParty = toParty
            };
        }
            public async Task Dont_Use_Scoring_System_ReceivingPMode_When_Already_Configure()
            {
                // Arrange
                var expected = new ReceivePMode {
                    Id = "static-receive-configured"
                };

                // Act
                StepResult result = await _step.ExecuteAsync(
                    new MessagingContext(
                        AS4Message.Empty,
                        MessagingContextMode.Receive)
                {
                    ReceivingPMode = expected
                });

                // Assert
                Assert.Same(
                    expected,
                    result.MessagingContext.ReceivingPMode);
            }
 protected void AssertPMode(ReceivePMode expectedPMode, StepResult result)
 {
     Assert.NotNull(expectedPMode);
     Assert.NotNull(result);
     Assert.Equal(expectedPMode, result.MessagingContext.ReceivingPMode);
 }