public async Task SaveAsync_Throws_WhenInvalidTimeEntry() { _validationService.ValidateSaveAsync(_timeEntry).Throws(new InvalidObjectException("Fake exception")); await Assert.ThrowsAsync <InvalidObjectException>(() => _controller.SaveAsync(_timeEntry)); }
public async Task <TimeEntryDto> SaveAsync([FromBody] TimeEntryDto timeEntry) { await _validationService.ValidateSaveAsync(timeEntry); return(await _timeEntryRepository.SaveAsync(timeEntry)); }