public async Task DispatchRangeAsync_WithMock(IDispatcher mock) { await mock.DispatchCommandAsync(new Cmd()); await mock.DispatchCommandAsync(new Cmd()); await mock.DispatchCommandAsync(new Cmd()); }
public async Task <IActionResult> Create([FromBody] CreatePersonRequest request) { var result = await _dispatcher.DispatchCommandAsync(new CreatePerson( PersonId.NewId(), new Name(request.FirstName, request.LastName))); return(Ok(result)); }
/// <summary> /// Helper method to dispatch a command through Saga custom dispatcher or, if not defined, CoreDispatcher. /// </summary> /// <param name="command">Command to dispatch.</param> protected Task DispatchCommandAsync(ICommand command) { if (_dispatcher != null) { return(_dispatcher.DispatchCommandAsync(command, this)); } else { return(CoreDispatcher.DispatchCommandAsync(command, this)); } }
public Task DispatchAsync_WithMock(IDispatcher mock) { return(mock.DispatchCommandAsync(new Cmd())); }
public MainWindowViewModel(IView view, IDispatcher dispatcher) : base(view) { SayHelloCommand = new AsyncDelegateCommand(_ => dispatcher.DispatchCommandAsync(new SayHelloCommand())); }
public async Task <Quote> PostAsync([FromBody] CreateQuoteRequest request) { var quote = await _dispatcher.DispatchCommandAsync(new CreateQuote(request.Phrase, request.Attribution)); return(new Quote(quote.Id, quote.Phrase, quote.Attribution, quote.CreatedAt, quote.UpdatedAt)); }