public void ConvertDatepickerUnprocessableExceptionTest() { var testDatepickerConversion = new TestDatepickerConversion().DatePickerConversionNoDates; var testUser = new TestUser().User; Assert.ThrowsAsync <UnprocessableException>(() => _datepickerLogic.ConvertDatepicker(testDatepickerConversion, testUser)); }
public async Task <ActionResult> Convert([FromBody] DatePickerConversion datepickerConverter) { try { UserHelper requestingUser = _controllerHelper.GetRequestingUser(this); await _datepickerLogic.ConvertDatepicker(datepickerConverter, requestingUser); return(Ok()); } catch (UnauthorizedAccessException) { return(Unauthorized()); } catch (UnprocessableException) { return(UnprocessableEntity()); } catch (NoNullAllowedException) { return(StatusCode(StatusCodes.Status304NotModified)); } catch (Exception e) { _logLogic.Log(e); return(StatusCode(StatusCodes.Status500InternalServerError)); } }