public static TrackedSessionConfiguration TrackActivity(this IHost host, TimeSpan trackingTimeout)
        {
            var session = new TrackedSession(host);

            session.Timeout = trackingTimeout;
            return(new TrackedSessionConfiguration(session));
        }
        /// <summary>
        ///     Executes an action and waits until the execution of all messages and all cascading messages
        ///     have completed
        /// </summary>
        /// <param name="runtime"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static async Task <ITrackedSession> ExecuteAndWait(this IHost host,
                                                                  Func <IMessageContext, Task> action,
                                                                  int timeoutInMilliseconds = 5000)
        {
            TrackedSession session = new TrackedSession(host)
            {
                Timeout   = timeoutInMilliseconds.Milliseconds(),
                Execution = action
            };

            await session.ExecuteAndTrack();

            return(session);
        }
        /// <summary>
        /// Advanced usage of the 'ExecuteAndWait()' message tracking and coordination for automated testing.
        /// Use this configuration if you want to coordinate message tracking across multiple Jasper
        /// applications running in the same process
        /// </summary>
        /// <param name="host"></param>
        /// <returns></returns>
        public static TrackedSessionConfiguration TrackActivity(this IHost host)
        {
            var session = new TrackedSession(host);

            return(new TrackedSessionConfiguration(session));
        }
 public TrackedSessionConfiguration(TrackedSession session)
 {
     _session = session;
 }