public async void Handle_ShouldCallGetCryptoCurrencyAsync() { //act await _testee.Handle(new Application.CQRS.Queries.GetCryptoCurrencyRawDataQuery(1), default); //assert A.CallTo(() => _cryptoCurrencyRepository.GetCryptoCurrencyAsync(1, default)).MustHaveHappenedOnceExactly(); }
public async void Code_WhenThereIsNotInDataBase_ShouldHaveValidationError(int id) { A.CallTo(() => _cryptoCurrencyRepository.GetCryptoCurrencyAsync(id, default)).Returns <CryptoCurrency>(null); (await _testee.ShouldHaveValidationErrorForAsync(x => x.Id, new RemoveCryptoCurrencyCommand(id))) .WithErrorMessage("The 'Code' does not exist!"); }
private async Task <bool> ContainCryptoCurrencyAlready(RemoveCryptoCurrencyCommand command, int id, CancellationToken cancellation) { var result = await _cryptoCurrencyRepository.GetCryptoCurrencyAsync(id, cancellation); return(result != default); }
public async Task <CryptoCurrencyRawResponse> Handle(GetCryptoCurrencyRawDataQuery request, CancellationToken cancellationToken) { var result = await _cryptoCurrencyRepository.GetCryptoCurrencyAsync(request.Id, cancellationToken); return(_mapper.MapCryptoCurrencyToCryptoCurrencyRawResponse(result)); }