public void handler_throw_exception_command_test()
        {
            var command = new ThrowExceptionCommand
            {
                AggregateRootId = ObjectId.GenerateNewStringId()
            };
            var commandResult = _commandService.ExecuteAsync(command).Result;

            Assert.IsNotNull(commandResult);
            Assert.AreEqual(CommandStatus.Failed, commandResult.Status);
        }
示例#2
0
 public Task HandleAsync(ICommandContext context, ThrowExceptionCommand command)
 {
     throw new Exception("CommandException");
 }
示例#3
0
 public void Handle(ThrowExceptionCommand command)
 {
     base.Handle(command);
     throw new TestCommandHandlerException("This is a triggered post-processing exception.");
 }
示例#4
0
 public Task HandleAsync(ThrowExceptionCommand command, CancellationToken cancellationToken = default(CancellationToken))
 {
     base.HandleAsync(command);
     return(Task.FromException(new TestCommandHandlerException("This is a triggered post-processing exception.")));
 }
示例#5
0
 public void HandleThrowExceptionCommand(ThrowExceptionCommand command)
 {
     BaseHandle(command);
     throw new TestCommandHandlerException("This is a triggered exception.");
 }
示例#6
0
 public void handler_throw_exception_command_test()
 {
     var command = new ThrowExceptionCommand
     {
         AggregateRootId = ObjectId.GenerateNewStringId()
     };
     var asyncResult = _commandService.ExecuteAsync(command).Result;
     Assert.IsNotNull(asyncResult);
     Assert.AreEqual(AsyncTaskStatus.Success, asyncResult.Status);
     var commandResult = asyncResult.Data;
     Assert.IsNotNull(commandResult);
     Assert.AreEqual(CommandStatus.Failed, commandResult.Status);
 }
 public void Handle(ICommandContext context, ThrowExceptionCommand command)
 {
     throw new Exception("CommandException");
 }