public void CreateRequestAppendsAPIKey() { var baseUri = new Uri("http://www.example.com"); var factory = new RequestFactory(baseUri, "apiKey"); var request = factory.CreateRequest("test"); Assert.IsTrue(request.RequestUri.Query.Contains("key=apiKey"), "Request does not have API key as query parameter."); }
public void CreateRequestUsesBaseUri() { var baseUri = new Uri("http://www.example.com"); var factory = new RequestFactory(baseUri, "apiKey"); var request = factory.CreateRequest("test"); Assert.IsTrue(baseUri.IsBaseOf(request.RequestUri), "Request does not have expected base URI."); }
public void CreateRequestAddsPassedParameters() { var baseUri = new Uri("http://www.example.com"); var factory = new RequestFactory(baseUri, "apiKey"); var request = factory.CreateRequest("test", new Dictionary<string, string>() { { "a", "b" }, { "c", "d" } }); Assert.IsTrue(request.RequestUri.Query.Contains("a=b"), "Request does not have first passed query parameter."); Assert.IsTrue(request.RequestUri.Query.Contains("c=d"), "Request does not have second passed query parameter."); }