static void Main(string[] args) { Console.WriteLine("Hello World!"); //RestClientLib rcl = new RestClientLib(); //rcl. //https://th-project.herokuapp.com/api/users string endPoint = @"https://th-project.herokuapp.com/api/users"; var client = new RestClientLib(endPoint); var json = client.MakeRequest(); Console.ReadLine(); //var json = client.MakeRequest("?param=0"); //var client = new RestClient(endpoint: endPoint, // method: HttpVerb.POST, // postData: "{'someValueToPost': 'The Value being Posted'}"); //var client = new RestClient(); //client.EndPoint = @"http:\\myRestService.com\api\"; ; //client.Method = HttpVerb.POST; //client.PostData = "{postData: value}"; //var json = client.MakeRequest(); }
public void TestMethod1() { string endPoint = @"https://th-project.herokuapp.com/api/users"; var client = new RestClientLib(endPoint); var json = client.MakeRequest(); Assert.AreEqual("[]", json); }
public void TestMethod4() { string endPoint = @"https://th-project.herokuapp.com/api/users/" + _id; var client = new RestClientLib(endPoint); client.Method = HttpVerb.DELETE; var json = client.MakeRequest(); dynamic jsonObj = JsonConvert.DeserializeObject(json); string msg = jsonObj.message.ToString(); Assert.AreEqual(msg, "user deleted successfully!"); }
public void TestMethod3() { string endPoint = @"https://th-project.herokuapp.com/api/users/" + _id; var client = new RestClientLib(endPoint); client.Method = HttpVerb.GET; var json = client.MakeRequest(); dynamic jsonObj = JsonConvert.DeserializeObject(json); string id = jsonObj._id.ToString(); Assert.AreEqual(_id, id); }
public void TestMethod2() { var client = new RestClientLib(); client.EndPoint = @"https://th-project.herokuapp.com/api/users"; client.Method = HttpVerb.POST; Jsonuser JU = new Jsonuser(); JU.first_name = "Tom"; JU.last_name = "Dick"; JU.email = "*****@*****.**"; JU.phone = "05612345678"; client.PostData = JsonConvert.SerializeObject(JU); var json = client.MakeRequest(); dynamic jsonObj = JsonConvert.DeserializeObject(json); _id = jsonObj._id.ToString(); Assert.AreNotEqual("", _id); }