コード例 #1
0
        public void Transform_HttpBecomesHttps()
        {
            var uri                     = new Uri($"http://www.bing.com/search?q={Query}");
            var uriProtocol             = new UriProtocol(uri);
            var searchEngineTransformer = new SearchEngineTransformer(uriProtocol, null);

            var transformedProtocol = searchEngineTransformer.Transform();

            Assert.Equal($"https://www.bing.com/search?q={Query}", (transformedProtocol as UriProtocol)?.Uri.AbsoluteUri);
        }
コード例 #2
0
        public void Transform_ReturnsTransformedProtocol(string searchEngineAddress)
        {
            var uri                     = new Uri($"https://www.bing.com/search?q={Query}");
            var uriProtocol             = new UriProtocol(uri);
            var searchEngine            = new SearchEngine("Search engine", searchEngineAddress);
            var searchEngineTransformer = new SearchEngineTransformer(uriProtocol, searchEngine);

            var transformedProtocol = searchEngineTransformer.Transform();

            Assert.Equal(searchEngineAddress + Query, (transformedProtocol as UriProtocol)?.Uri.AbsoluteUri);
        }