示例#1
0
        public R ArmOneValidateCallAction <R, T>(T model, string url, string token, string sessionString)
        {
            if (model == null)
            {
                return(default(R));
            }
            var response = default(R);

            try
            {
                var restResponse = TestJsonHelper.ArmOneTokenPostRequest(_contentRootPath, model, url, token, sessionString);
                if (!string.IsNullOrEmpty(restResponse))
                {
                    response = JsonConvert.DeserializeObject <R>(restResponse);
                }
            }
            catch (Exception ex)
            {
                Utilities.ManageExceptions.ProcessError(ex, _contentRootPath);
            }

            return(response);
        }
示例#2
0
        public R GetArmOneDetails <R>(string url)
        {
            if (url == null)
            {
                return(default(R));
            }
            var response = default(R);

            try
            {
                var restResponse = TestJsonHelper.GetArmOneRequest(_contentRootPath, url);
                if (!string.IsNullOrEmpty(restResponse))
                {
                    response = JsonConvert.DeserializeObject <R>(restResponse);
                }
            }
            catch (Exception ex)
            {
                Utilities.ManageExceptions.ProcessError(ex, _contentRootPath);
            }

            return(response);
        }
示例#3
0
        public R CallRestAction <R, T>(T model, string url)
        {
            if (model == null)
            {
                return(default(R));
            }
            var response = default(R);

            try
            {
                var restResponse = TestJsonHelper.PostRequest(_contentRootPath, url, model);

                if (restResponse.Content != null && restResponse.Content.Length > 0)
                {
                    response = JsonConvert.DeserializeObject <R>(restResponse.Content);
                }
            }
            catch (Exception ex)
            {
                Utilities.ManageExceptions.ProcessError(ex, _contentRootPath);
            }

            return(response);
        }