コード例 #1
0
        public void TestPacParsingUrlNoProxy()
        {
            NSError error;
            string  pacPath   = Path.Combine(NSBundle.MainBundle.BundlePath, "example.pac");
            var     pacUri    = new Uri(pacPath);
            var     targetUri = new Uri("http://google.com");
            var     proxies   = CFNetwork.ExecuteProxyAutoConfigurationUrl(pacUri, targetUri, out error);

            Assert.IsNull(error, "Null error");
            Assert.IsNotNull(proxies, "Not null proxies");
            Assert.AreEqual(1, proxies.Length, "Proxies length");
            Assert.AreEqual(CFProxyType.None, proxies [0].ProxyType);
        }
コード例 #2
0
        public void TestPACParsingUrl()
        {
            NSError error;
            string  pacPath   = Path.Combine(NSBundle.MainBundle.BundlePath, "example.pac");
            var     pacUri    = new Uri(pacPath);
            var     targetUri = new Uri("http://docs.xamarin.com");
            var     proxies   = CFNetwork.ExecuteProxyAutoConfigurationUrl(pacUri, targetUri, out error);

            Assert.IsNull(error, "Null error");
            Assert.AreEqual(1, proxies.Length, "Length");
            // assert the data of the proxy, although we are really testing the js used
            Assert.AreEqual(8080, proxies [0].Port, "Port");
        }