public void ExcludedHostsMatchingTest(string testString, bool isMatch)
        {
            var rule          = new NoHardcodedEnvironmentUrlsRule();
            var configuration = BicepTestConstants.BuiltInConfiguration;

            rule.Configure(configuration.Analyzers);

            Assert.AreEqual(isMatch, rule.ExcludedHosts.Any(host => NoHardcodedEnvironmentUrlsRule.FindHostnameMatches(host, testString).Any()));
        }
Exemplo n.º 2
0
        public void ExcludedHostsMatchingTest(string testString, bool isMatch)
        {
            var rule         = new NoHardcodedEnvironmentUrlsRule();
            var configHelper = new ConfigHelper(); // this ensures configuration is loaded from resources

            rule.Configure(configHelper.Config);

            Assert.AreEqual(isMatch, rule.ExcludedHosts.Any(host => NoHardcodedEnvironmentUrlsRule.FindHostnameMatches(host, testString).Any()));
        }
        public void ExcludedHostsRegexTest(string host, bool isMatch)
        {
            var rule         = new NoHardcodedEnvironmentUrlsRule();
            var configHelper = new ConfigHelper(); // this ensures configuration is loaded from resources

            rule.Configure(configHelper.Config);

            var regex = rule.CreateExcludedHostsRegex();

            Assert.AreEqual(isMatch, regex.IsMatch(host));
        }