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