public void TestProxySetupHostAndPortOnly() { var dummyConfig = new AmazonEC2Config(); dummyConfig.ProxyHost = Host; dummyConfig.ProxyPort = Port; WebProxy proxy = dummyConfig.GetWebProxy(); var address = proxy.Address; Assert.AreEqual(address.Host, Host); Assert.AreEqual(address.Port, Port); Assert.AreEqual(0, proxy.BypassList.Length); Assert.IsFalse(proxy.BypassProxyOnLocal); }
public void TestProxySetupWithBypass() { var dummyConfig = new AmazonEC2Config(); dummyConfig.ProxyHost = Host; dummyConfig.ProxyPort = Port; dummyConfig.ProxyBypassList = new List<string>(BypassList); dummyConfig.ProxyBypassOnLocal = true; WebProxy proxy = dummyConfig.GetWebProxy(); Assert.AreEqual(BypassList.Count, proxy.BypassList.Length); // making assumption here that order is retained on assignment // inside WebProxy - seems to be the case for (int i = 0; i < BypassList.Count; i++) { Assert.AreEqual(BypassList[i], proxy.BypassList[i]); } Assert.IsTrue(proxy.BypassProxyOnLocal); }
public void TestProxySetupWithSchemedHost() { // verifies bug fix that the http:// scheme is not doubled // up in the proxy address if the user specifies it when setting // proxy host (the bug yielded an address like http://http/host) var dummyConfig = new AmazonEC2Config(); var host = string.Concat("http://", Host); dummyConfig.ProxyHost = host; dummyConfig.ProxyPort = Port; WebProxy proxy = dummyConfig.GetWebProxy(); Assert.IsTrue(proxy.Address.ToString().StartsWith(host, StringComparison.OrdinalIgnoreCase)); }