コード例 #1
0
        void InvokeTimeouts(IEnumerable <TimeoutMessage <object> > messages)
        {
            messages
            .OrderBy(t => t.Within)
            .ToList()
            .ForEach(t =>
            {
                var messageType = messageCreator.GetMappedTypeFor(t.Message.GetType());
                var invokers    = saga.GetType().CreateInvokers(messageType, typeof(IHandleTimeouts <>));
                invokers.InvokeSerially(saga, t.Message, testContext).GetAwaiter().GetResult();
            });

            testContext.Validate();
            testContext = new TestingContext(messageCreator);
        }
コード例 #2
0
        internal Saga(T saga)
        {
            this.saga   = saga;
            testContext = new TestingContext(messageCreator);

            if (saga.Entity == null)
            {
                var prop = typeof(T).GetProperty("Data");
                if (prop == null)
                {
                    return;
                }

                var sagaData = Activator.CreateInstance(prop.PropertyType) as IContainSagaData;
                saga.Entity = sagaData;
            }

            saga.Entity.OriginalMessageId = Guid.NewGuid().ToString();
            saga.Entity.Originator        = SagaConsts.Originator;
        }
コード例 #3
0
 /// <summary>
 /// Creates a new instance of the handler tester.
 /// </summary>
 internal Handler(T handler)
 {
     this.handler = handler;
     testableMessageHandlerContext = new TestingContext(messageCreator);
 }