public async Task JobProfileOverviewSegmentServicePatchHiddenAlternativeTitleReturnsExceptionWhenPatchmodelIsNull() { // arrange PatchHiddenAlternativeTitleModel patchModel = null; var documentId = Guid.NewGuid(); // act var exceptionResult = await Assert.ThrowsAsync <ArgumentNullException>(async() => await jobProfileOverviewSegmentService.PatchHiddenAlternativeTitleAsync(patchModel, documentId).ConfigureAwait(false)).ConfigureAwait(false); // assert Assert.Equal("Value cannot be null. (Parameter 'patchModel')", exceptionResult.Message); }
public async Task <IActionResult> PatchHiddenAlternativeTitle([FromBody] PatchHiddenAlternativeTitleModel patchHiddenAlternativeTitleModel, Guid documentId) { logService.LogInformation($"{PatchHiddenAlternativeTitleActionName} has been called"); if (patchHiddenAlternativeTitleModel == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = await jobProfileOverviewSegmentService.PatchHiddenAlternativeTitleAsync(patchHiddenAlternativeTitleModel, documentId).ConfigureAwait(false); if (response != HttpStatusCode.OK && response != HttpStatusCode.Created) { logService.LogError($"{PatchHiddenAlternativeTitleActionName}: Error while patching Hidden Alternative Title content for Job Profile with Id: {patchHiddenAlternativeTitleModel.JobProfileId} for the {patchHiddenAlternativeTitleModel.Title} title"); } return(new StatusCodeResult((int)response)); }