Пример #1
0
        public void PortMustBeSpecified()
        {
            INewRelicConfig config = new TestConfig
            {
                ProxyHost = "Host",
                ProxyUserName = "******",
                ProxyPassword = "******",
            };

            Runner runner = new Runner(config);
        }
Пример #2
0
        public void ProxySetupAcceptsEmptyCredentials()
        {
            INewRelicConfig config = new TestConfig
            {
                ProxyHost = "Host",
                ProxyPort = 8080,
            };

            Runner runner = new Runner(config);
            IWebProxy proxy = WebRequest.DefaultWebProxy;
            Uri proxyAddress = proxy.GetProxy(new Uri("http://www.google.com"));
            NetworkCredential credential = (NetworkCredential)proxy.Credentials;

            Assert.IsNull(credential, "No credentials were provided, this should be null.");
        }
Пример #3
0
        public void ProxySetupEmptyPassword()
        {
            INewRelicConfig config = new TestConfig
            {
                ProxyHost = "Host",
                ProxyPort = 8080,
                ProxyUserName = "******",
            };

            Runner runner = new Runner(config);
            IWebProxy proxy = WebRequest.DefaultWebProxy;
            Uri proxyAddress = proxy.GetProxy(new Uri("http://www.google.com"));
            NetworkCredential credential = (NetworkCredential)proxy.Credentials;

            Assert.AreEqual(config.ProxyUserName, credential.UserName, "Username is incorrect.");
            Assert.IsTrue(string.IsNullOrEmpty(credential.Password), "Password should be empty.");
        }
Пример #4
0
        public void RunnerSetsUpProxy()
        {
            INewRelicConfig config = new TestConfig
            {
                ProxyHost = "Host",
                ProxyPort = 8080,
                ProxyUserName = "******",
                ProxyPassword = "******",
            };

            Runner runner = new Runner(config);
            IWebProxy proxy = WebRequest.DefaultWebProxy;
            Uri proxyAddress = proxy.GetProxy(new Uri("http://www.google.com"));
            NetworkCredential credential = (NetworkCredential)proxy.Credentials;

            Assert.IsTrue(string.Equals(config.ProxyHost, proxyAddress.Host, StringComparison.InvariantCultureIgnoreCase), "Host is incorrect.");
            Assert.AreEqual(config.ProxyPort, proxyAddress.Port, "Port is incorrect.");
            Assert.AreEqual(config.ProxyUserName, credential.UserName, "Username is incorrect.");
            Assert.AreEqual(config.ProxyPassword, credential.Password, "Password is incorrect.");
        }