public void TestPACParsingScriptError() { NSError error = null; var script = "Not VALID js"; var targetUri = new Uri("http://google.com"); var proxies = CFNetwork.ExecuteProxyAutoConfigurationScript(script, targetUri, out error); Assert.IsNotNull(error, "Not null error"); Assert.IsNull(proxies, "Null proxies"); }
public void TestPACParsingScriptNoProxy() { string pacPath = Path.Combine(NSBundle.MainBundle.BundlePath, "example.pac"); NSError error = null; var script = File.ReadAllText(pacPath); var targetUri = new Uri("http://google.com"); var proxies = CFNetwork.ExecuteProxyAutoConfigurationScript(script, 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); }
public void TestPACParsingScript() { // get the path for the pac file, try to parse it and ensure that // our cb was called string pacPath = Path.Combine(NSBundle.MainBundle.BundlePath, "example.pac"); NSError error = null; var script = File.ReadAllText(pacPath); var targetUri = new Uri("http://docs.xamarin.com"); var proxies = CFNetwork.ExecuteProxyAutoConfigurationScript(script, 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"); }