예제 #1
0
        public void FirstTest()
        {
            /* Creating and assigning value to the variables that will be used in the API placeholders */
            string nameOfCity        = "Round Rock";
            string nameOfState       = "TX";
            int    expectedBehaviour = 200;
            /* Assigning the API link in the variable "url" with the placeholders being replaced by the equivalent data using the interpolation */
            string url = $"https://api.interzoid.com/getweather?license={kevin.license}&city={nameOfCity}&state={nameOfState}";

            try
            {
                /* Creation of a variable called "response" of type HttpResponseMessage to store
                 * the return that the HTTP Request GET method will bring when reading the API present in the variable "url" */
                HttpResponseMessage response = RestMethods.ReturnGet(url);
                /* Stores in the variable "body" as a string the unformatted data/content that was present in the variable "response" */
                string body = response.Content.ReadAsStringAsync().Result;
                /* Verifying that the value assigned in the "StatusCode" field that was returned through the "body" variable is the same as that in the "ExpectedBehaviour" field, if true the test will pass */
                Assert.AreEqual((int)response.StatusCode, expectedBehaviour);

                /* A variable was created so that it was possible to store the content present in the variable "body", however, formatted as a JSON using the method "JOBject.Parse (Body)"
                 * as the type of data present in the content will change at run time, we need the type of the variable to be dynamic*/
                dynamic formatedBody = JObject.Parse(body);
                /* The "statusCode" variable was created to store the value in the "Code" field of the "formatedBody" variable */
                string statusCode = formatedBody.Code;
                /* Checking if the data in the variable "statusCode" is the same as the word "Sucess" */
                Assert.AreEqual(statusCode, "Success");
            }
            /* If the Try block fails, the error message will be attributed to the exception argument "e" */
            catch (Exception e)
            {
                /* In case the test fails, the message stored in "e" will be displayed */
                Assert.Fail(e.Message);
            }
        }
예제 #2
0
        public static String ToVerbsList(this RestMethods meths)
        {
            var verbs = new List <String>();

            if ((meths & RestMethods.Get) != 0)
            {
                verbs.Add("GET");
            }
            if ((meths & RestMethods.Put) != 0)
            {
                verbs.Add("PUT");
            }
            if ((meths & RestMethods.Post) != 0)
            {
                verbs.Add("POST");
            }
            if ((meths & RestMethods.Merge) != 0)
            {
                verbs.Add("MERGE");
            }
            if ((meths & RestMethods.Delete) != 0)
            {
                verbs.Add("DELETE");
            }

            ((meths | RestMethods.Get | RestMethods.Put | RestMethods.Post | RestMethods.Merge | RestMethods.Delete) ==
             (RestMethods.Get | RestMethods.Put | RestMethods.Post | RestMethods.Merge | RestMethods.Delete)).AssertTrue();
            return(verbs.StringJoin());
        }
예제 #3
0
 //Contructor
 public Request(LinkedList<string> uri, RestMethods method, Dictionary<string, string> data, User user, string authorization)
 {
     this.uri = uri;
     this.method = method;
     this.data = data;
     this.user = user;
     this.authorization = authorization;
 }
예제 #4
0
        /// <summary>
        /// Retrieves the ably service time
        /// </summary>
        /// <returns></returns>
        public DateTimeOffset Time()
        {
            var request = RestMethods.CreateGetRequest("/time");

            request.SkipAuthentication = true;
            var response = RestMethods.ExecuteRequest <List <long> >(request);

            return(response.First().FromUnixTimeInMilliseconds());
        }
예제 #5
0
        public void get_page_delayInfo()
        {
            Dictionary <String, String> paramMap = new Dictionary <String, String>();

            paramMap.Add("delay", "3");
            response = RestMethods.getWithPathParam(paramMap, strURL + Constants.USERS_ENDPOINT);
            Console.WriteLine(response.Content.ToString());
            Assert.Pass();
        }
        public void testPostByDeleteUser()
        {
            response = RestMethods.deleteWithPathParam(strURL + Constants.USERS_ENDPOINT + "/2");
            Console.WriteLine(response.StatusCode);
            String token = response.Content;

            Console.WriteLine("Response is - " + token);
            Assert.Pass();
        }
예제 #7
0
        public static bool ChangeUsername(Guid token, string newUsername)
        {
            var response = new RestMethods(TinderAPI.Username, token).Put(new Username()
            {
                username = newUsername
            });

            return(response == "");
        }
예제 #8
0
        public ActionResult Details(string id)
        {
            var card = RestMethods.GetCard(id, this.RestClient);

            card.Attachments = RestMethods.GetCardAttachments(id, this.RestClient);
            card.Checklists  = RestMethods.GetCardChecklists(id, this.RestClient);

            return(View(card));
        }
예제 #9
0
        /// <summary>
        /// Retrieves the stats for the application based on a custom query. It should be used with <see cref="DataRequestQuery"/>.
        /// It is mainly because of the way a PaginatedResource defines its queries. For retrieving Stats with special parameters use <see cref="RestClient.Stats(StatsDataRequestQuery query)"/>
        /// </summary>
        /// <example>
        /// var client = new RestClient("validkey");
        /// var stats = client.Stats();
        /// var nextPage = cliest.Stats(stats.NextQuery);
        /// </example>
        /// <param name="query"><see cref="DataRequestQuery"/> and <see cref="StatsDataRequestQuery"/></param>
        /// <returns></returns>
        public IPaginatedResource <Stats> Stats(DataRequestQuery query)
        {
            query.Validate();

            var request = RestMethods.CreateGetRequest("/stats");

            request.AddQueryParameters(query.GetParameters());

            return(RestMethods.ExecuteRequest <PaginatedResource <Stats> >(request));
        }
예제 #10
0
        public static TinderProfile HideAge(Guid token, bool hide)
        {
            Models.User.TinderPlus.HideAge showAge = new HideAge()
            {
                hide_age = hide
            };
            TinderProfile response = new RestMethods(TinderAPI.Profile, token).Post <TinderProfile>(showAge);

            return(response);
        }
예제 #11
0
        public static Update GetUpdates(Guid token, DateTime initialDate = default(DateTime))
        {
            LastActivityDate obj = new LastActivityDate()
            {
                last_activity_date = (initialDate != default(DateTime)) ? initialDate.ToTinderString() : ""
            };

            var response = new RestMethods(TinderAPI.Updates, token).Post <Update>(obj);

            return(response);
        }
예제 #12
0
        /// <summary>
        /// Generates a signed "object" JWT.
        /// 1 REST call is made to pre-insert class.
        /// If this JWT only contains 1 object, usually isn't too long; can be used in Android intents/redirects.
        /// </summary>
        /// <param name="verticalType"> pass type to created</param>
        /// <param name="classId">the unique identifier for the class</param>
        /// <param name="objectId">the unique identifier for the object</param>
        /// <returns></returns>
        public string makeObjectJwt(VerticalType verticalType, string classId, string objectId)
        {
            ResourceDefinitions resourceDefinitions = ResourceDefinitions.getInstance();
            RestMethods         restMethods         = RestMethods.getInstance();
            // create JWT to put objects and class into JSON Web Token (JWT) format for Google Pay API for Passes
            Jwt googlePassJwt = new Jwt();

            // get class, object definitions, insert class (check in Merchant center GUI: https://pay.google.com/gp/m/issuer/list)
            try
            {
                switch (verticalType)
                {
                case VerticalType.OFFER:
                    OfferClass  offerClass  = resourceDefinitions.makeOfferClassResource(classId);
                    OfferObject offerObject = resourceDefinitions.makeOfferObjectResource(objectId, classId);
                    System.Console.WriteLine("\nMaking REST call to insert class");
                    OfferClass classResponse = restMethods.insertOfferClass(offerClass);
                    System.Console.WriteLine("\nMaking REST call to get object to see if it exists.");
                    OfferObject objectResponse = restMethods.getOfferObject(objectId);
                    // check responses
                    if (!(classResponse is null))
                    {
                        System.Console.WriteLine($"classId: {classId} inserted.");
                    }
                    else
                    {
                        System.Console.WriteLine($"classId: {classId} insertion failed. See above Server Response for more information.");
                    }
                    if (!(objectResponse is null))
                    {
                        System.Console.WriteLine($"objectId: {objectId} already exists.");
                    }
                    if (!(objectResponse is null) && objectResponse.ClassId != offerObject.ClassId)
                    {
                        System.Console.WriteLine($"the classId of inserted object is ({objectResponse.ClassId}). " +
                                                 $"It does not match the target classId ({offerObject.ClassId}). The saved object will not " +
                                                 "have the class properties you expect.");
                    }
                    // need to add only object because class was pre-inserted
                    googlePassJwt.addOfferObject(offerObject);
                    break;

                case VerticalType.LOYALTY:
                    LoyaltyClass  loyaltyClass  = resourceDefinitions.makeLoyaltyClassResource(classId);
                    LoyaltyObject loyaltyObject = resourceDefinitions.makeLoyaltyObjectResource(objectId, classId);
                    System.Console.WriteLine("\nMaking REST call to insert class");
                    LoyaltyClass loyaltyClassResponse = restMethods.insertLoyaltyClass(loyaltyClass);
                    System.Console.WriteLine("\nMaking REST call to get object to see if it exists.");
                    LoyaltyObject loyaltyObjectResponse = restMethods.getLoyaltyObject(objectId);
                    // check responses
                    if (!(loyaltyClassResponse is null))
                    {
                        System.Console.WriteLine($"classId: {classId} inserted.");
                    }
예제 #13
0
        public static TinderProfile HideAds(Guid token, bool hide)
        {
            HideAds obj = new HideAds()
            {
                hide_ads = hide
            };

            TinderProfile response = new RestMethods(TinderAPI.Profile, token).Post <TinderProfile>(obj);

            return(response);
        }
예제 #14
0
        public static TinderProfile HideDistance(Guid token, bool hide)
        {
            HideDistance hideDistace = new HideDistance()
            {
                hide_distance = hide
            };

            TinderProfile response = new RestMethods(TinderAPI.Profile, token).Post <TinderProfile>(hideDistace);

            return(response);
        }
예제 #15
0
        //public static void ChangeLocation(Guid token,double Lat, double lon)
        //{

        //}



        public static void MessageMatch(Guid token, string otherUserID, string msg)
        {
            Message content = new Message()
            {
                message = msg
            };
            var response = new RestMethods(TinderAPI.Message.Replace("{id}", otherUserID), token).Post(content);

            int a = 0;

            a++;
        }
예제 #16
0
        public void testPostRequest_InvalidLogin()
        {
            jsonObject = new JsonObject();
            jsonObject.Add("email", "peter@klaven");
            response = RestMethods.postWithJsonBodyParam(jsonObject, strURL + Constants.LOGIN_ENDPOINT);
            Console.WriteLine(response.StatusCode);
            String token = response.Content;

            Console.WriteLine("Generated Token is - " + token);
            Assert.AreEqual("OK", response.StatusCode.ToString(), "Status code is not valid");
            Assert.Pass();
        }
예제 #17
0
        /// <summary>
        /// Creates documentation content.
        /// </summary>
        /// <returns>
        /// HTML documentation content as string.
        /// </returns>
        private string CreateDocumentation()
        {
            if (TemplateSet == null)
            {
                TemplateSet = new SimpleTemplateSet();
            }

            // take all REST methods marked with [Method] attibute
            RestMethods =
                RestApiAssemblies
                .Distinct()
                .SelectMany(a => a.GetTypes())
                .SelectMany(c => c.GetMethods()
                            .Where(m => m.IsDefined(typeof(MethodAttribute), false)));

            // methods count
            int methodsCount = RestMethods.Count();

            // order methods according to groups order and methods order in each group
            RestMethods = RestMethods.OrderBy(m =>
            {
                // get method group info from attribute
                OrderAttribute attrGroup = m.GetRadishAttribute <OrderAttribute>();

                // if group is not defined for the method, assume the method has default order "0"
                if (attrGroup == null)
                {
                    return(0);
                }

                // if group is not defined in groups list
                if (attrGroup.GroupKey != null && !MethodGroups.ContainsKey(attrGroup.GroupKey))
                {
                    string fullMethodName = string.Format("{0}.{1}()", m.ReflectedType.Name, m.Name);
                    throw new Exception(String.Format("Group with key \"{0}\" was specified for the method \"{1}\", but group with this key was not added to the Documentor. Use AddMethodGroup(\"{0}\", ...) to set it.", attrGroup.GroupKey, fullMethodName));
                }

                // if default group (group key is null or empty)
                if (String.IsNullOrEmpty(attrGroup.GroupKey))
                {
                    return(attrGroup.MethodOrder);
                }
                // group was defined
                else
                {
                    return((int)(MethodGroups[attrGroup.GroupKey].GroupOrder * methodsCount) + attrGroup.MethodOrder);
                }
            });

            // initiate rendering documentation with Page template
            return(TemplateSet.RenderTemplate <AbstractTemplateSet>(mContext, ts => ts.Page));
        }
예제 #18
0
        public ActionResult Index()
        {
            if (TrelloToken == null)
            {
                return(RedirectToAction("AuthorizeToken"));
            }

            AddDefaultParameters();

            var boards = RestMethods.GetUserBoards(LoggedUserId, RestClient).OrderBy(x => x.Name);

            return(View(boards));
        }
        public void testPostByUpdateUser()
        {
            jsonObject = new JsonObject();
            jsonObject.Add("name", "morpheus");
            jsonObject.Add("job", "zion resident");
            response = RestMethods.putWithJsonBodyParam(jsonObject, strURL + Constants.USERS_ENDPOINT + "/2");
            Console.WriteLine(response.StatusCode);
            Assert.AreEqual("OK", response.StatusCode.ToString(), "Status code is not valid");
            String token = response.Content;

            Console.WriteLine("Response is - " + token);
            Assert.Pass();
        }
        public void VerifyGetUserDetailsApi()
        {
            Dictionary <String, String> pathParamMap = new Dictionary <String, String>();

            pathParamMap.Add("pathParam1", "users");
            pathParamMap.Add("pathParam2", "1");

            response = RestMethods.GetWithPathParam(pathParamMap, baseUrl);
            var responseJsonObject = JObject.Parse(response.Content);

            Assert.AreEqual(System.Net.HttpStatusCode.OK, response.StatusCode);
            Assert.NotNull(responseJsonObject.GetValue("userId"));
            Assert.NotNull(responseJsonObject.GetValue("name"));
            Assert.NotNull(responseJsonObject.GetValue("email"));
        }
예제 #21
0
        private static async Task <string> MakeRequest(string url, RestMethods method, DecompressionMethods methods, Encoding encoding)
        {
            var request = (HttpWebRequest)HttpWebRequest.Create(url);

            request.Method = method.ToString().ToUpper();
            request.AutomaticDecompression = methods;
            using (var response = await request.GetResponseAsync())
            {
                using (var stream = response.GetResponseStream())
                    using (var streamReader = new StreamReader(stream ?? throw new InvalidOperationException(), encoding))
                    {
                        return(await streamReader.ReadToEndAsync());
                    }
            }
        }
예제 #22
0
        public ActionResult GenerateBoardDoc(string id, string boardLists, string listsWithCommentsIds)
        {
            AddDefaultParameters();

            var board = RestMethods.GetBoard(id, RestClient);

            if (board == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (boardLists != null)
            {
                var      arrOfId         = boardLists.Split(',');
                string[] commentsListIds = {};
                if (listsWithCommentsIds != null)
                {
                    commentsListIds = listsWithCommentsIds.Split(',');
                }
                var trelloList = arrOfId.Select(listId => RestMethods.GetList(listId, RestClient)).ToList();
                board.Lists = trelloList;

                foreach (var list in board.Lists)
                {
                    list.Cards = RestMethods.GetListCards(list.Id, RestClient);
                    foreach (var card in list.Cards)
                    {
                        card.Attachments = RestMethods.GetCardAttachments(card.Id, RestClient).ToList();
                        card.Checklists  = RestMethods.GetCardChecklists(card.Id, RestClient).ToList();
                        if (commentsListIds.Any(x => x == list.Id.ToString()))
                        {
                            card.Actions = RestMethods.GetCardActions(card.Id, RestClient).ToList();
                        }
                    }
                }
            }

            byte[] fileContents;
            using (var memoryStream = new MemoryStream())
            {
                WordExtraction.DocumentWithOpenXml(memoryStream, board);
                fileContents = memoryStream.ToArray();
            }

            Response.AppendHeader("Content-Disposition", string.Format("inline; filename={0}.docx", board.Name));
            return(new FileContentResult(fileContents, "application/vnd.openxmlformats-officedocument.wordprocessingml.document"));
        }
        public void VerifyHealthStatus()
        {
            Dictionary <String, String> pathParamMap = new Dictionary <String, String>();

            pathParamMap.Add("pathParam1", "say");
            pathParamMap.Add("pathParam2", "hello");

            Dictionary <String, String> queryParamMap = new Dictionary <String, String>();

            queryParamMap.Add("name", "Osanda");

            response = RestMethods.GetWithPathAndQueryParam(pathParamMap, queryParamMap, baseUrl);
            var responseJsonObject = JObject.Parse(response.Content);

            Assert.AreEqual(System.Net.HttpStatusCode.OK, response.StatusCode);
            Assert.AreEqual("Hello Osanda! Welcome to mock server.", responseJsonObject.GetValue("message").ToString());
        }
예제 #24
0
        public void TestInsertOfferClassAndObject()
        {
            RestMethods         restMethods         = RestMethods.getInstance();
            ResourceDefinitions resourceDefinitions = ResourceDefinitions.getInstance();
            VerticalType        verticalType        = Services.VerticalType.OFFER;
            Config      config         = Config.getInstance();
            string      UUID           = Guid.NewGuid().ToString();
            string      classUid       = $"{verticalType.ToString()}_CLASS_{UUID}";
            string      classId        = $"{config.getIssuerId()}.{classUid}";
            string      UUIDobj        = Guid.NewGuid().ToString();
            string      objectUid      = $"{verticalType.ToString()}_OBJECT_{UUIDobj}";
            string      objectId       = $"{config.getIssuerId()}.{objectUid}";
            OfferClass  classResponse  = restMethods.insertOfferClass(resourceDefinitions.makeOfferClassResource(classId));
            OfferObject objectResponse = restMethods.insertOfferObject(resourceDefinitions.makeOfferObjectResource(objectId, classId));

            Console.WriteLine("classResponse: " + classResponse);
            Console.WriteLine("objectResponse: " + objectResponse);
        }
        public void TestInsertTransitClassAndObject()
        {
            RestMethods         restMethods         = RestMethods.getInstance();
            ResourceDefinitions resourceDefinitions = ResourceDefinitions.getInstance();
            VerticalType        verticalType        = Services.VerticalType.TRANSIT;
            Config        config         = Config.getInstance();
            string        UUID           = Guid.NewGuid().ToString();
            string        classUid       = $"{verticalType.ToString()}_CLASS_{UUID}";
            string        classId        = $"{config.getIssuerId()}.{classUid}";
            string        UUIDobj        = Guid.NewGuid().ToString();
            string        objectUid      = $"{verticalType.ToString()}_OBJECT_{UUIDobj}";
            string        objectId       = $"{config.getIssuerId()}.{objectUid}";
            TransitClass  classResponse  = restMethods.insertTransitClass(resourceDefinitions.makeTransitClassResource(classId));
            TransitObject objectResponse = restMethods.insertTransitObject(resourceDefinitions.makeTransitObjectResource(objectId, classId));

            Assert.NotNull(classResponse);
            Assert.NotNull(objectResponse);
        }
예제 #26
0
        public void SecondTest()
        {
            string nameOfCity        = "Tampa";
            string nameOfState       = "TX";
            int    expectedBehaviour = 404;
            string url = $"https://api.interzoid.com/getweather?license={kevin.license}&city={nameOfCity}&state={nameOfState}";

            try
            {
                HttpResponseMessage response = RestMethods.ReturnGet(url);
                string body = response.Content.ReadAsStringAsync().Result;

                /* As the variable "body" was unable to return a valid JSON file
                 * I was able to check the HTTP Status code, but not its description. */
                Assert.AreEqual((int)response.StatusCode, expectedBehaviour);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }
        }
예제 #27
0
        public ActionResult ReceiveToken(string token)
        {
            if (token == "")
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (token != null)
            {
                TrelloToken = token;
                RestClient.AddDefaultParameter("key", Startup.ConsumerKey);
                var tokenInfo = RestMethods.GetTokenInformation(token, RestClient);
                LoggedUserId = tokenInfo.UserId;
                var trelloUser = RestMethods.GetTrelloUser(LoggedUserId, RestClient);
                Username = trelloUser.Username;

                return(RedirectToAction("Index"));
            }

            return(View("ReceiveToken"));
        }
예제 #28
0
        public ActionResult Details(string id)
        {
            if (TrelloToken == null)
            {
                return(RedirectToAction("AuthorizeToken"));
            }

            AddDefaultParameters();

            var board       = RestMethods.GetBoard(id, RestClient);
            var boardLists  = RestMethods.GetAllLists(board.Id, RestClient);
            var trelloLists = boardLists as TrelloList[] ?? boardLists.ToArray();

            foreach (var x in trelloLists)
            {
                x.HasComments = false;
                x.Checked     = true;
            }
            board.Lists = trelloLists;

            return(View(board));
        }
예제 #29
0
        public T MakeRequest <T>(RestMethods rpcMethod, params object[] parameters)
        {
            var jsonRpcRequest = new JsonRpcRequest(1, rpcMethod.ToString(), parameters);
            var webRequest     = (HttpWebRequest)WebRequest.Create(_coinService.Parameters.SelectedDaemonUrl);

            SetBasicAuthHeader(webRequest, _coinService.Parameters.RpcUsername, _coinService.Parameters.RpcPassword);
            webRequest.Credentials = new NetworkCredential(_coinService.Parameters.RpcUsername, _coinService.Parameters.RpcPassword);
            webRequest.ContentType = "application/json-rpc";
            webRequest.Method      = "POST";
            webRequest.Proxy       = null;
            webRequest.Timeout     = _coinService.Parameters.RpcRequestTimeoutInSeconds * GlobalConstants.MillisecondsInASecond;
            var byteArray = jsonRpcRequest.GetBytes();

            webRequest.ContentLength = jsonRpcRequest.GetBytes().Length;

            try
            {
                using (var dataStream = webRequest.GetRequestStream())
                {
                    dataStream.Write(byteArray, 0, byteArray.Length);
                    dataStream.Dispose();
                }
            }
            catch (Exception exception)
            {
                throw new RestException("There was a problem sending the request to the wallet", exception);
            }

            try
            {
                string json;

                using (var webResponse = webRequest.GetResponse())
                {
                    using (var stream = webResponse.GetResponseStream())
                    {
                        using (var reader = new StreamReader(stream))
                        {
                            var result = reader.ReadToEnd();
                            reader.Dispose();
                            json = result;
                        }
                    }
                }

                var rpcResponse = JsonConvert.DeserializeObject <JsonRestResponse <T> >(json);
                return(rpcResponse.Result);
            }
            catch (WebException webException)
            {
                #region RPC Internal Server Error (with an Error Code)

                var webResponse = webException.Response as HttpWebResponse;

                if (webResponse != null)
                {
                    switch (webResponse.StatusCode)
                    {
                    case HttpStatusCode.InternalServerError:
                    {
                        using (var stream = webResponse.GetResponseStream())
                        {
                            if (stream == null)
                            {
                                throw new RestException("The RPC request was either not understood by the server or there was a problem executing the request", webException);
                            }

                            using (var reader = new StreamReader(stream))
                            {
                                var result = reader.ReadToEnd();
                                reader.Dispose();

                                try
                                {
                                    var jsonRpcResponseObject = JsonConvert.DeserializeObject <JsonRestResponse <object> >(result);

                                    var internalServerErrorException = new RpcInternalServerErrorException(jsonRpcResponseObject.Error.Message, webException)
                                    {
                                        RpcErrorCode = jsonRpcResponseObject.Error.Code
                                    };

                                    throw internalServerErrorException;
                                }
                                catch (JsonException)
                                {
                                    throw new RestException(result, webException);
                                }
                            }
                        }
                    }

                    default:
                        throw new RestException("The RPC request was either not understood by the server or there was a problem executing the request", webException);
                    }
                }

                #endregion

                #region RPC Time-Out

                if (webException.Message == "The operation has timed out")
                {
                    throw new RpcRequestTimeoutException(webException.Message);
                }

                #endregion

                throw new RestException("An unknown web exception occured while trying to read the JSON response", webException);
            }
            catch (JsonException jsonException)
            {
                throw new RpcResponseDeserializationException("There was a problem deserializing the response from the wallet", jsonException);
            }
            catch (ProtocolViolationException protocolViolationException)
            {
                throw new RestException("Unable to connect to the server", protocolViolationException);
            }
            catch (Exception exception)
            {
                var queryParameters = jsonRpcRequest.Parameters.Cast <string>().Aggregate(string.Empty, (current, parameter) => current + (parameter + " "));
                throw new Exception($"A problem was encountered while calling MakeRpcRequest() for: {jsonRpcRequest.Method} with parameters: {queryParameters}. \nException: {exception.Message}");
            }
        }
예제 #30
0
 public void get_single_user_details()
 {
     response = RestMethods.getCall(strURL + Constants.USERS_ENDPOINT + "/" + "2");
     Console.WriteLine(response.Content.ToString());
     Assert.Pass();
 }
 public void ClearInstance()
 {
     //instance member
     RestMethods.ClearAllStaticValues(GetType());
 }