public void SendAsync_ThrowsException_WhenCommandIsNull() { _createAggregate = null; Assert.ThrowsAsync <ArgumentNullException>(async() => await _sut.SendAsync(_createAggregate)); }
protected override async ValueTask <IActivityExecutionResult> OnExecuteAsync(ActivityExecutionContext context) { await _bus.SendAsync(Message, Headers); return(Done()); }
/// <inheritdoc /> public Task SendAsync <TCommand>(TCommand command) where TCommand : ICommand { return(_commandSender.SendAsync(command)); }
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()); }
public async Task <IActionResult> AddToRole(Guid id, [FromBody] string roleName) { await _commandSender.SendAsync <AddUserToRole, User>(new AddUserToRole { Id = id, RoleName = roleName }); return(new NoContentResult()); }
public ActionResult Add(string name) { _commandSender.SendAsync(new CreateInventoryItem(Guid.NewGuid(), name)); return(RedirectToAction("Index")); }
public static Task SendAsync(this ICommandSender commandSender, object message, CancellationToken cancellationToken = default) => commandSender.SendAsync(message, default, default, cancellationToken);