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