API Testing using RestSharp
I have added config.json file and maintaining all the URL in the file. Example
{
"Url1": "http://localhost:45677",
"Url2": "http://localhost:45897"
}
I would like to fetch particular URL from the config.json based on the given parameter added in class2
public class class2
{
public void Url1_Request()
{
var client = class1.RestClient("Url1");
}
public void Url2_Request()
{
var client = class1.RestClient("Url2");
}
}
public class class1
{
public static RestClient RestClient(string url)
{
var client = new RestClient(url);
return client;
}
}