public async Task JobProfileOverviewSegmentServicePatchWorkingPatternDetailReturnsExceptionWhenPatchmodelIsNull() { // arrange PatchWorkingPatternDetailModel patchModel = null; var documentId = Guid.NewGuid(); // act var exceptionResult = await Assert.ThrowsAsync <ArgumentNullException>(async() => await jobProfileOverviewSegmentService.PatchWorkingPatternDetailAsync(patchModel, documentId).ConfigureAwait(false)).ConfigureAwait(false); // assert Assert.Equal("Value cannot be null. (Parameter 'patchModel')", exceptionResult.Message); }
public async Task <IActionResult> PatchWorkingPatternDetail([FromBody] PatchWorkingPatternDetailModel patchWorkingPatternDetailModel, Guid documentId) { logService.LogInformation($"{PatchWorkingPatternDetailActionName} has been called"); if (patchWorkingPatternDetailModel == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = await jobProfileOverviewSegmentService.PatchWorkingPatternDetailAsync(patchWorkingPatternDetailModel, documentId).ConfigureAwait(false); if (response != HttpStatusCode.OK && response != HttpStatusCode.Created) { logService.LogError($"{PatchWorkingPatternDetailActionName}: Error while patching Working Pattern Detail content for Job Profile with Id: {patchWorkingPatternDetailModel.JobProfileId} for the {patchWorkingPatternDetailModel.Title} pattern detail"); } return(new StatusCodeResult((int)response)); }