public async Task HowToBecomeSegmentServicePatchLinksReturnsExceptionWhenPatchmodelIsNull() { // arrange PatchLinksModel patchModel = null; var documentId = Guid.NewGuid(); // act var exceptionResult = await Assert.ThrowsAsync <ArgumentNullException>(async() => await howToBecomeSegmentService.PatchLinksAsync(patchModel, documentId).ConfigureAwait(false)).ConfigureAwait(false); // assert Assert.Equal("Value cannot be null. (Parameter 'patchModel')", exceptionResult.Message); }
public async Task <IActionResult> PatchLinks([FromBody] PatchLinksModel patchLinksModel, Guid documentId) { logService.LogInformation($"{PatchLinksActionName} has been called"); if (patchLinksModel == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var response = await howToBecomeSegmentService.PatchLinksAsync(patchLinksModel, documentId).ConfigureAwait(false); if (response != HttpStatusCode.OK && response != HttpStatusCode.Created) { logService.LogError($"{PatchLinksActionName}: Error while patching Link content for Job Profile with Id: {patchLinksModel.JobProfileId} for the {patchLinksModel.RouteName.ToString()} link"); } return(new StatusCodeResult((int)response)); }