Beispiel #1
0
            public async Task DispatchRangeAsync_WithMock(IDispatcher mock)
            {
                await mock.DispatchCommandAsync(new Cmd());

                await mock.DispatchCommandAsync(new Cmd());

                await mock.DispatchCommandAsync(new Cmd());
            }
Beispiel #2
0
        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));
        }
Beispiel #3
0
 /// <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));
     }
 }
Beispiel #4
0
 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()));
 }
Beispiel #6
0
        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));
        }