public async Task JobProfileServiceGetByIdReturnsSuccess() { // arrange Guid documentId = Guid.NewGuid(); var expectedResult = A.Fake <JobProfileModel>(); A.CallTo(() => repository.GetAsync(A <Expression <Func <JobProfileModel, bool> > > .Ignored)).Returns(expectedResult); // act var result = await jobProfileService.GetByIdAsync(documentId).ConfigureAwait(false); // assert A.CallTo(() => repository.GetAsync(A <Expression <Func <JobProfileModel, bool> > > .Ignored)).MustHaveHappenedOnceExactly(); A.Equals(result, expectedResult); }
public async Task <IActionResult> Delete(Guid documentId) { logService.LogInformation($"{nameof(Delete)} has been called"); var jobProfileModel = await jobProfileService.GetByIdAsync(documentId).ConfigureAwait(false); if (jobProfileModel == null) { logService.LogWarning($"{nameof(Document)} has returned no content for: {documentId}"); return(NotFound()); } await jobProfileService.DeleteAsync(documentId).ConfigureAwait(false); logService.LogInformation($"{nameof(Delete)} has deleted content for: {jobProfileModel.CanonicalName}"); return(Ok()); }