public async Task JobProfileOverviewSegmentServicePatchSocCodeDataReturnsExceptionWhenPatchmodelIsNull() { // arrange PatchSocDataModel patchModel = null; var documentId = Guid.NewGuid(); // act var exceptionResult = await Assert.ThrowsAsync <ArgumentNullException>(async() => await jobProfileOverviewSegmentService.PatchSocCodeDataAsync(patchModel, documentId).ConfigureAwait(false)).ConfigureAwait(false); // assert Assert.Equal("Value cannot be null. (Parameter 'patchModel')", exceptionResult.Message); }
public async Task <IActionResult> PatchSocCodeData([FromBody] PatchSocDataModel patchSocDataModel, Guid documentId) { logService.LogInformation($"{PatchSocCodeDataActionName} has been called"); if (patchSocDataModel == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = await jobProfileOverviewSegmentService.PatchSocCodeDataAsync(patchSocDataModel, documentId).ConfigureAwait(false); if (response != HttpStatusCode.OK && response != HttpStatusCode.Created) { logService.LogError($"{PatchSocCodeDataActionName}: Error while patching Soc Data content for Job Profile with Id: {patchSocDataModel.JobProfileId} for the {patchSocDataModel.SocCode} soc code"); } return(new StatusCodeResult((int)response)); }