public void RestClient_PostShouldReturn_WrongSignature() { RestClient client = new RestClient( DEV.BASEURI, DEV.CLIENTID, DEV.APPID, DEV.APIKEY, DEV.APISECRET, DEV.SERVICE); Response response = null; var data = new { test = 0 }; var body = JsonUtility.ToJson(data); var coroutine = client.Post(string.Format(URL_POST_SCORE), body, (Response res) => { response = res; }); while (coroutine.MoveNext()) { ;} Assert.AreEqual(401, response.StatusCode); Assert.IsTrue(response.www.error.ToLowerInvariant().Contains("401 unauthorized"), response.www.error); Assert.IsTrue(response.www.text.ToLowerInvariant().Contains("wrong signature"), response.www.text); }
public void RestClient_GetShouldReturn_200() { RestClient client = new RestClient( DEV.BASEURI, DEV.CLIENTID, DEV.APPID, DEV.APIKEY, DEV.APISECRET, DEV.SERVICE); Response response = null; var coroutine = client.Get(string.Format(URL_GET_SCORE_0, 10), (Response res) => { response = res; }); while (coroutine.MoveNext()) { ;} Assert.AreEqual(200, response.StatusCode); Assert.AreEqual("", response.www.error); }