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