Esempio n. 1
0
        public void CanConfigureNoProxy()
        {
            proxyServer.EnableLogResourcesOnResponse();
            Proxy proxyToUse = proxyServer.AsProxy();

            proxyToUse.AddBypassAddresses(EnvironmentManager.Instance.UrlBuilder.HostName);

            if (TestUtilities.IsInternetExplorer(driver))
            {
                proxyToUse.AddBypassAddress("<-localhost>");
            }

            InitLocalDriver(proxyToUse);

            localDriver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("simpleTest.html");
            Assert.That(proxyServer.HasBeenCalled("simpleTest.html"), Is.False);

            localDriver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIsViaNonLoopbackAddress("simpleTest.html");
            Assert.That(proxyServer.HasBeenCalled("simpleTest.html"), Is.True);
        }
Esempio n. 2
0
        public void CanNotChangeAlreadyInitializedProxyType()
        {
            Proxy proxy = new Proxy();

            proxy.Kind = ProxyKind.Direct;

            Assert.That(() => proxy.IsAutoDetect       = true, Throws.InvalidOperationException);
            Assert.That(() => proxy.SocksPassword      = "", Throws.InvalidOperationException);
            Assert.That(() => proxy.SocksUserName      = "", Throws.InvalidOperationException);
            Assert.That(() => proxy.SocksProxy         = "", Throws.InvalidOperationException);
            Assert.That(() => proxy.SocksVersion       = 5, Throws.InvalidOperationException);
            Assert.That(() => proxy.FtpProxy           = "", Throws.InvalidOperationException);
            Assert.That(() => proxy.HttpProxy          = "", Throws.InvalidOperationException);
            Assert.That(() => proxy.SslProxy           = "", Throws.InvalidOperationException);
            Assert.That(() => proxy.ProxyAutoConfigUrl = "", Throws.InvalidOperationException);
            Assert.That(() => proxy.AddBypassAddress("localhost"), Throws.InvalidOperationException);
            Assert.That(() => proxy.AddBypassAddresses("", ""), Throws.InvalidOperationException);
            Assert.That(() => proxy.Kind = ProxyKind.System, Throws.InvalidOperationException);

            Proxy proxy2 = new Proxy();

            proxy2.Kind = ProxyKind.AutoDetect;
            Assert.That(() => proxy2.Kind = ProxyKind.System, Throws.InvalidOperationException);
        }