Ejemplo n.º 1
0
        /// <summary>
        /// Check that the object publishes a message of the given type complying with the given predicate.
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="check"></param>
        /// <returns></returns>
        public void ExpectPublish <TMessage>(PublishPredicate <TMessage> check) where TMessage : IMessage
        {
            Delegate d = new HandleMessageDelegate(
                () => ExpectCallToPublish(
                    delegate(TMessage[] msgs)
            {
                foreach (TMessage msg in msgs)
                {
                    if (!check(msg))
                    {
                        return(false);
                    }
                }

                return(true);
            }
                    )
                );

            delegates.Add(d);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Check that the object publishes a message of the given type complying with the given predicate.
        /// </summary>
        /// <typeparam name="TMessage"></typeparam>
        /// <param name="check"></param>
        /// <returns></returns>
        public void ExpectPublish <TMessage>(PublishPredicate <TMessage> check)
        {
            MessagingBestPractices.AssertIsValidForPubSub(typeof(TMessage));

            Delegate d = new HandleMessageDelegate(
                () => ExpectCallToPublish(
                    delegate(TMessage[] msgs)
            {
                foreach (TMessage msg in msgs)
                {
                    if (!check(msg))
                    {
                        return(false);
                    }
                }

                return(true);
            }
                    )
                );

            delegates.Add(d);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Check that the saga does not publish any messages of the given type complying with the given predicate.
 /// </summary>
 /// <typeparam name="TMessage"></typeparam>
 /// <param name="check"></param>
 /// <returns></returns>
 public Saga <T> ExpectNotPublish <TMessage>(PublishPredicate <TMessage> check)
 {
     helper.ExpectNotPublish(check);
     return(this);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Check that the saga publishes a message of the given type complying with the given predicate.
 /// </summary>
 /// <typeparam name="TMessage"></typeparam>
 /// <param name="check"></param>
 /// <returns></returns>
 public Saga <T> ExpectPublish <TMessage>(PublishPredicate <TMessage> check) where TMessage : IMessage
 {
     helper.ExpectPublish(check);
     return(this);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Check that the saga publishes a message of the given type complying with the given predicate.
 /// </summary>
 /// <typeparam name="TMessage"></typeparam>
 /// <param name="check"></param>
 /// <returns></returns>
 public Handler <T> ExpectPublish <TMessage>(PublishPredicate <TMessage> check)
 {
     helper.ExpectPublish(check);
     return(this);
 }