Ejemplo n.º 1
0
        public void MakeRequest_CorrectParameters_ReturnsTrue()
        {
            SearchProvider search   = new GoogleProvider(configuration);
            string         query    = "Bible";
            int            num      = 7;
            string         host     = "https://www.googleapis.com/customsearch/v1";
            string         key      = UrlEncode(configuration["Google:key"]);
            string         cx       = UrlEncode(configuration["Google:cx"]);
            string         expected = $"{host}?q={query}&cx={cx}&key={key}&num={num}";
            string         url      = search.MakeRequest(query, num).Address.AbsoluteUri;

            Console.WriteLine($"got:\n{url}");
            Console.WriteLine($"expected:\n{expected}");
            Assert.IsTrue(url == expected);
        }