Esempio n. 1
0
 public void SendAsync_ThrowsException_WhenCommandIsNull()
 {
     _createAggregate = null;
     Assert.ThrowsAsync <ArgumentNullException>(async() => await _sut.SendAsync(_createAggregate));
 }
Esempio n. 2
0
        protected override async ValueTask <IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context)
        {
            await _bus.SendAsync(Message, Headers);

            return(Done());
        }
Esempio n. 3
0
 /// <inheritdoc />
 public Task SendAsync <TCommand>(TCommand command) where TCommand : ICommand
 {
     return(_commandSender.SendAsync(command));
 }
Esempio n. 4
0
 public async Task ThrowsArgumentNullException() => await Assert.ThrowsAsync <ArgumentNullException>(() => _sender.SendAsync <ICommand>(null));
        public async Task <IActionResult> AddProduct([FromBody] CreateProductCommand command)
        {
            await _commandSender.SendAsync(command);

            return(Ok());
        }
Esempio n. 6
0
        public async Task <IActionResult> AddToRole(Guid id, [FromBody] string roleName)
        {
            await _commandSender.SendAsync <AddUserToRole, User>(new AddUserToRole { Id = id, RoleName = roleName });

            return(new NoContentResult());
        }
Esempio n. 7
0
 public ActionResult Add(string name)
 {
     _commandSender.SendAsync(new CreateInventoryItem(Guid.NewGuid(), name));
     return(RedirectToAction("Index"));
 }
Esempio n. 8
0
 public static Task SendAsync(this ICommandSender commandSender, object message, CancellationToken cancellationToken = default) => commandSender.SendAsync(message, default, default, cancellationToken);