public void event_handler_priority_test() { var noteId = ObjectId.GenerateNewStringId(); var command1 = new CreateTestAggregateCommand { AggregateRootId = noteId, Title = "Sample Title1" }; var command2 = new TestEventPriorityCommand { AggregateRootId = noteId }; var commandResult1 = _commandService.ExecuteAsync(command1, CommandReturnType.EventHandled).Result; var commandResult2 = _commandService.ExecuteAsync(command2, CommandReturnType.EventHandled).Result; Thread.Sleep(3000); Assert.AreEqual(CommandStatus.Success, commandResult1.Status); Assert.AreEqual(CommandStatus.Success, commandResult2.Status); Assert.AreEqual(3, HandlerTypes[1].Count); Assert.AreEqual(typeof(Handler3).Name, HandlerTypes[1][0]); Assert.AreEqual(typeof(Handler2).Name, HandlerTypes[1][1]); Assert.AreEqual(typeof(Handler1).Name, HandlerTypes[1][2]); Assert.AreEqual(3, HandlerTypes[2].Count); Assert.AreEqual(typeof(Handler122).Name, HandlerTypes[2][0]); Assert.AreEqual(typeof(Handler121).Name, HandlerTypes[2][1]); Assert.AreEqual(typeof(Handler123).Name, HandlerTypes[2][2]); Assert.AreEqual(3, HandlerTypes[3].Count); Assert.AreEqual(typeof(Handler1232).Name, HandlerTypes[3][0]); Assert.AreEqual(typeof(Handler1231).Name, HandlerTypes[3][1]); Assert.AreEqual(typeof(Handler1233).Name, HandlerTypes[3][2]); HandlerTypes.Clear(); }
public void event_handler_priority_test() { var noteId = ObjectId.GenerateNewStringId(); var command1 = new CreateTestAggregateCommand { AggregateRootId = noteId, Title = "Sample Title1" }; var command2 = new TestEventPriorityCommand { AggregateRootId = noteId }; _commandService.ExecuteAsync(command1, CommandReturnType.EventHandled).Wait(); _commandService.ExecuteAsync(command2, CommandReturnType.EventHandled).Wait(); Assert.AreEqual(9, HandlerTypes.Count); Assert.AreEqual(typeof(Handler3).Name, HandlerTypes[0]); Assert.AreEqual(typeof(Handler2).Name, HandlerTypes[1]); Assert.AreEqual(typeof(Handler1).Name, HandlerTypes[2]); Assert.AreEqual(typeof(Handler122).Name, HandlerTypes[3]); Assert.AreEqual(typeof(Handler121).Name, HandlerTypes[4]); Assert.AreEqual(typeof(Handler123).Name, HandlerTypes[5]); Assert.AreEqual(typeof(Handler1232).Name, HandlerTypes[6]); Assert.AreEqual(typeof(Handler1231).Name, HandlerTypes[7]); Assert.AreEqual(typeof(Handler1233).Name, HandlerTypes[8]); HandlerTypes.Clear(); }
public void event_handler_priority_test() { var noteId = ObjectId.GenerateNewStringId(); var command1 = new CreateTestAggregateCommand { AggregateRootId = noteId, Title = "Sample Title1" }; var command2 = new TestEventPriorityCommand { AggregateRootId = noteId }; _commandService.ExecuteAsync(command1, CommandReturnType.EventHandled).Wait(); _commandService.ExecuteAsync(command2, CommandReturnType.EventHandled).Wait(); Assert.AreEqual(9, HandlerTypes.Count); Assert.AreEqual(typeof(Handler3).Name, HandlerTypes[0]); Assert.AreEqual(typeof(Handler2).Name, HandlerTypes[1]); Assert.AreEqual(typeof(Handler1).Name, HandlerTypes[2]); Assert.AreEqual(typeof(Handler122).Name, HandlerTypes[3]); Assert.AreEqual(typeof(Handler121).Name, HandlerTypes[4]); Assert.AreEqual(typeof(Handler123).Name, HandlerTypes[5]); Assert.AreEqual(typeof(Handler1232).Name, HandlerTypes[6]); Assert.AreEqual(typeof(Handler1231).Name, HandlerTypes[7]); Assert.AreEqual(typeof(Handler1233).Name, HandlerTypes[8]); HandlerTypes.Clear(); }
public async Task HandleAsync(ICommandContext context, TestEventPriorityCommand command) { var testAggregate = await context.GetAsync <TestAggregate>(command.AggregateRootId); testAggregate.TestEvents(); }
public void Handle(ICommandContext context, TestEventPriorityCommand command) { context.Get <TestAggregate>(command.AggregateRootId).TestEvents(); }