public void GetAllowedStates_InCorrectType_Test() { GetAllowedStatesRequest request = new GetAllowedStatesRequest { ContractNumber = contract, Token = "", UserId = userId, Version = version }; ObservationsManager oManager = new ObservationsManager(); GetAllowedStatesResponse response = oManager.GetAllowedObservationStates(request); Assert.IsNull(response.States); }
public GetAllowedStatesResponse Get(GetAllowedStatesRequest request) { GetAllowedStatesResponse response = new GetAllowedStatesResponse(); ObservationsManager om = new ObservationsManager(); ValidateTokenResponse result = null; try { request.Token = base.Request.Headers["Token"] as string; result = Security.IsUserValidated(request.Version, request.Token, request.ContractNumber); if (result.UserId.Trim() != string.Empty) { request.UserId = result.UserId; response = om.GetAllowedObservationStates(request); } else { throw new UnauthorizedAccessException(); } } catch (Exception ex) { CommonFormatter.FormatExceptionResponse(response, base.Response, ex); if ((ex is WebServiceException) == false) { om.LogException(ex); } } finally { if (result != null) { AuditHelper.LogAuditData(request, result.SQLUserId, null, System.Web.HttpContext.Current.Request, request.GetType().Name); } } return(response); }