Ejemplo n.º 1
0
        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.");
        }
Ejemplo n.º 2
0
        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.");
        }
Ejemplo n.º 3
0
        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.");
        }