public void ShouldCallValidate_WhenHaveValidator() { InitializeValidators(); Dispatcher.Validate(Message); MockedValidator.Verify(x => x.Validate(Message)); }
public async void ShouldApplyValidation_WhenDispatchQuery() { InitializeValidators(); MockedValidator.Setup(x => x.Validate(Message)).Throws(new DispatcherException()); Should .Throw <DispatcherException>(() => ((IDispatcher)Dispatcher).Dispatch <Message, Result>(Message)); await Should .ThrowAsync <DispatcherException>(async() => await ((IAsyncDispatcher)Dispatcher).DispatchAsync <Message, Result>(Message)); await Should .ThrowAsync <DispatcherException>(async() => await ((ICancellableAsyncDispatcher)Dispatcher).DispatchAsync <Message, Result>(Message, CancellationToken)); }