Esempio n. 1
0
        public void Checks_ReadingInCorrectFile_ReturnsChecksCorrectly()
        {
            const int expectedNumberOfChecks = 4;
            const int expectedNumberOfNegativeContentMatches = 1;
            const int expectedNumberOfPositiveContentMatches = 1;
            var config = new XmlConfig(@"..\..\Data\urls.xml");

            var checks = config.Checks;

            IList<ContentMatch> matches;

            Assert.That(checks.Count, Is.EqualTo(expectedNumberOfChecks));

            Assert.That(checks[0].Url, Is.EqualTo("http://www.yahoo.com/"));
            matches = checks[0].ContentMatches;
            Assert.That(matches.Count(m => m.Required), Is.EqualTo(expectedNumberOfPositiveContentMatches));
            Assert.That(matches.Count(m => !m.Required), Is.EqualTo(expectedNumberOfNegativeContentMatches));

            Assert.That(checks[1].Url, Is.EqualTo("http://www.google.com/"));
            matches = checks[1].ContentMatches;
            Assert.That(matches.Count(m => m.Required), Is.EqualTo(expectedNumberOfPositiveContentMatches));
            Assert.That(matches.Count(m => !m.Required), Is.EqualTo(0));

            Assert.That(checks[2].Url, Is.EqualTo("http://www.github.com/"));
            matches = checks[2].ContentMatches;
            Assert.That(matches.Count(m => m.Required), Is.EqualTo(expectedNumberOfPositiveContentMatches));
            Assert.That(matches.Count(m => !m.Required), Is.EqualTo(0));

            Assert.That(checks[3].Url, Is.EqualTo("http://www.bbc.co.uk/"));
            matches = checks[3].ContentMatches;
            Assert.That(matches.Count(m => m.Required), Is.EqualTo(expectedNumberOfPositiveContentMatches));
            Assert.That(matches.Count(m => !m.Required), Is.EqualTo(0));
        }
Esempio n. 2
0
        public void Checks_ReadingInFileWithEmptyMatches_ReturnsEmptyListOfMatches()
        {
            const int expectedNumberOfMatches = 0;
            var config = new XmlConfig(@"..\..\Data\empty_items.xml");

            var checks = config.Checks;

            Assert.That(checks[0].ContentMatches.Count, Is.EqualTo(expectedNumberOfMatches));
        }
Esempio n. 3
0
        public void Checks_ReadingInEmptyFile_ReturnsEmptyListOfChecks()
        {
            const int expectedNumberOfChecks = 0;
            var config = new XmlConfig(@"..\..\Data\empty.xml");

            var checks = config.Checks;

            Assert.That(checks.Count, Is.EqualTo(expectedNumberOfChecks));
        }
Esempio n. 4
0
        private static IConfig GetConfig(string file)
        {
            IConfig config;

            if (IsXmlFile(file))
            {
                config = new XmlConfig(file);
            }
            else
            {
                config = new FileConfig(file);
            }

            return config;
        }
Esempio n. 5
0
        public void XmlConfig_ImplementsIConfig()
        {
            var config = new XmlConfig(@"..\..\Data\urls.xml");

            Assert.That(config, Is.InstanceOf<IConfig>());
        }
Esempio n. 6
0
        public void XmlConfig_ImplementsIConfig()
        {
            var config = new XmlConfig(_testPath + @"SiteWarmer.Core.Test\Data\urls.xml");

            Assert.That(config, Is.InstanceOf<IConfig>());
        }