private static Property NotifyMethod_Should_Be_Specified_When_We_Notify_MessageProducer(
            bool notifyMessageProducer,
            Func <SendingProcessingMode, SendHandling> getHandling)
        {
            return(Prop.ForAll(
                       CreateMethodGen().ToArbitrary(),
                       method =>
            {
                // Arrange
                var pmode = ValidSendingPModeFactory.Create();
                SendHandling sendHandling = getHandling(pmode);
                sendHandling.NotifyMessageProducer = notifyMessageProducer;
                sendHandling.NotifyMethod = method;

                // Act
                ValidationResult result = ExerciseValidation(pmode);

                // Assert
                bool specifiedNotifyMethod = SpecifiedMethod(method);
                return result.IsValid
                .Equals(notifyMessageProducer && specifiedNotifyMethod)
                .Or(!notifyMessageProducer)
                .Label(
                    $"Validation has {(result.IsValid ? "succeeded" : "failed")} " +
                    $"but the NotifyMethod {(specifiedNotifyMethod ? "is" : "isn't")} specified " +
                    $"while the NotifyMessageProducer is {(notifyMessageProducer ? "enabled" : "disabled")}");
            }));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the <see cref="OutException.Operation"/> based on the configuration in the specified <paramref name="exceptionHandling"/>.
        /// </summary>
        /// <param name="exceptionHandling">The exception handling of the <see cref="SendingProcessingMode"/></param>
        public OutException SetOperationFor(SendHandling exceptionHandling)
        {
            bool needsToBeNotified = exceptionHandling?.NotifyMessageProducer == true;

            Operation = needsToBeNotified ? Operation.ToBeNotified : default(Operation);
            return(this);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SendingProcessingMode" /> class.
 /// </summary>
 public SendingProcessingMode()
 {
     AllowOverride     = false;
     MepBinding        = MessageExchangePatternBinding.Push;
     Reliability       = new SendReliability();
     ReceiptHandling   = new SendReceiptHandling();
     ErrorHandling     = new SendHandling();
     ExceptionHandling = new SendHandling();
     Security          = new Security();
     MessagePackaging  = new SendMessagePackaging();
 }