Exemplo n.º 1
0
        public void NullNewRelicInsightsMetadataReturnsException()
        {
            NewRelicInsightsMetadataException newRelicInsightsMetadataException;

            var newRelicInsightsMetadataIsValid =
                NewRelicInsightsMetadataValidator.TryValidate(null,
                                                              out newRelicInsightsMetadataException);

            Assert.IsFalse(newRelicInsightsMetadataIsValid);
            Assert.IsInstanceOfType(newRelicInsightsMetadataException,
                                    typeof(NewRelicInsightsMetadataException));
        }
Exemplo n.º 2
0
        public void InvalidAccountIDReturnsException()
        {
            var newRelicInsightsMetadata = new NewRelicInsightsMetadata();
            NewRelicInsightsMetadataException newRelicInsightsMetadataException;

            var newRelicInsightsMetadataIsValid =
                NewRelicInsightsMetadataValidator.TryValidate(newRelicInsightsMetadata,
                                                              out newRelicInsightsMetadataException);

            Assert.IsFalse(newRelicInsightsMetadataIsValid);
            Assert.IsInstanceOfType(newRelicInsightsMetadataException,
                                    typeof(NewRelicInsightsMetadataException));
        }
Exemplo n.º 3
0
        public void InvalidURIReturnsException()
        {
            var newRelicInsightsMetadata = new NewRelicInsightsMetadata
            {
                AccountID = "Mock Account ID",
                APIKey    = "Mock API key"
            };

            NewRelicInsightsMetadataException newRelicInsightsMetadataException;

            var newRelicInsightsMetadataIsValid =
                NewRelicInsightsMetadataValidator.TryValidate(newRelicInsightsMetadata,
                                                              out newRelicInsightsMetadataException);

            Assert.IsFalse(newRelicInsightsMetadataIsValid);
            Assert.IsInstanceOfType(newRelicInsightsMetadataException,
                                    typeof(NewRelicInsightsMetadataException));
        }
Exemplo n.º 4
0
        public void ZeroTimeoutReturnsExceptionWhenUseNonDefaultTimeoutIsSpecified()
        {
            var newRelicInsightsMetadata = new NewRelicInsightsMetadata
            {
                AccountID            = "Mock Account ID",
                APIKey               = "Mock API key",
                URI                  = new Uri("http://localhost"),
                UseNonDefaultTimeout = true
            };

            NewRelicInsightsMetadataException newRelicInsightsMetadataException;

            var newRelicInsightsMetadataIsValid =
                NewRelicInsightsMetadataValidator.TryValidate(newRelicInsightsMetadata,
                                                              out newRelicInsightsMetadataException);

            Assert.IsFalse(newRelicInsightsMetadataIsValid);
            Assert.IsInstanceOfType(newRelicInsightsMetadataException,
                                    typeof(NewRelicInsightsMetadataException));
        }
Exemplo n.º 5
0
        public void TimeoutIsSetWhenUseNonDefaultTimeoutIsSpecified()
        {
            var newRelicInsightsMetadata = new NewRelicInsightsMetadata
            {
                AccountID            = "Mock Account ID",
                APIKey               = "Mock API key",
                URI                  = new Uri("http://localhost"),
                UseNonDefaultTimeout = true,
                NonDefaultTimeout    = new TimeSpan(0, 0, 5)
            };

            NewRelicInsightsMetadataException newRelicInsightsMetadataException;

            var newRelicInsightsMetadataIsValid =
                NewRelicInsightsMetadataValidator.TryValidate(newRelicInsightsMetadata,
                                                              out newRelicInsightsMetadataException);

            Assert.IsTrue(newRelicInsightsMetadataIsValid);
            Assert.IsNull(newRelicInsightsMetadataException);
        }
Exemplo n.º 6
0
        public void WebProxyIsSetWhenUseProxyIsSpecified()
        {
            var newRelicInsightsMetadata = new NewRelicInsightsMetadata
            {
                AccountID   = "Mock Account ID",
                APIKey      = "Mock API key",
                URI         = new Uri("http://localhost"),
                UseWebProxy = true,
                WebProxy    = new WebProxy()
            };

            NewRelicInsightsMetadataException newRelicInsightsMetadataException;

            var newRelicInsightsMetadataIsValid =
                NewRelicInsightsMetadataValidator.TryValidate(newRelicInsightsMetadata,
                                                              out newRelicInsightsMetadataException);

            Assert.IsTrue(newRelicInsightsMetadataIsValid);
            Assert.IsNull(newRelicInsightsMetadataException);
        }