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); }
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; }
/// <summary> /// Creates a new instance of the handler tester. /// </summary> internal Handler(T handler) { this.handler = handler; testableMessageHandlerContext = new TestingContext(messageCreator); }