public void BuildRequest_GETRequestDataSupplied_ReturnsValidIPandaServiceRequest() { var proxy = new ServiceProxy(_cloudId, _accessKey, _secretKey, _apiHost); var request = proxy.BuildRequest("get", "videos.json", new Dictionary <string, string> { { "some_parameter", "some_value" }, { "another_parameter", "another_value" } }); Assert.IsTrue(request.Verb == "GET", "request method should retain verb passed to RestClient"); Assert.IsTrue(request.BaseUrl == "http://api.pandastream.com/v2/videos.json", "base url should contain the host, version and path passed to RestClient"); Assert.IsTrue(request.Url.Contains("http://api.pandastream.com/v2/videos.json?some_parameter=some_value&another_parameter=another_value&access_key=some_access_key&cloud_id=some_cloud_id×tamp="), "Url should contain host, version, path and query string parameters for GET requests"); Assert.IsTrue(request.SignedParameters.Contains( "some_parameter=some_value&another_parameter=another_value&access_key=some_access_key&cloud_id=some_cloud_id×tamp="), "SignedParameters should contain the supplied parameters, access key, cloudId and timestamp in the query string of a GET request"); Assert.IsTrue(request.SignedParameters.Contains( "&signature="), "SignedParameters should be signed"); Console.WriteLine("Verb: {0}", request.Verb); Console.WriteLine("BaseUrl: {0}", request.BaseUrl); Console.WriteLine("SignedParameters: {0}", request.SignedParameters); Console.WriteLine("Url: {0}", request.Url); }
public void BuildRequest_PUTRequestDataSupplied_ReturnsValidIPandaServiceRequest() { var proxy = new ServiceProxy(_cloudId, _accessKey, _secretKey, _apiHost); var request = proxy.BuildRequest("put", "videos.json", new Dictionary <string, string> { { "some_parameter", "some_value" }, { "another_parameter", "another_value" } }); Assert.IsTrue(request.Verb == "PUT", "request method should retain verb passed to RestClient"); Assert.IsTrue(request.BaseUrl == "http://api.pandastream.com/v2/videos.json", "base url should contain the host, version and path passed to RestClient"); Assert.IsTrue(request.Url.Equals("http://api.pandastream.com/v2/videos.json"), "Url should contain host, version and path with no query string parameters for POST and PUT requests"); Console.WriteLine("Verb: {0}", request.Verb); Console.WriteLine("BaseUrl: {0}", request.BaseUrl); Console.WriteLine("SignedParameters: {0}", request.SignedParameters); Console.WriteLine("Url: {0}", request.Url); }