Пример #1
0
        public void CreateRulesWithoutSpecificContentTest()
        {
            var ruleMetdata = new RuleMetadata(_createDelegate);

            Assert.IsFalse(ruleMetdata.NeedsSpecificContent);
            var rules = ruleMetdata.CreateRules();

            Assert.AreEqual(1, rules.Count);
            Assert.IsInstanceOfType(rules[0], typeof(RowContentFilter));
            var filter = (RowContentFilter)rules[0];

            Assert.IsNull(filter.ExpectedContent);
            Assert.IsNull(filter.Count);
        }
Пример #2
0
        public void CreateRulesWithSpecificContentWithSpecificCountTest()
        {
            var ruleMetdata = new RuleMetadata(_createDelegate, _options);

            Assert.IsTrue(ruleMetdata.NeedsSpecificContent);
            Assert.IsTrue(ruleMetdata.NeedsSpecificCount);
            var rules = ruleMetdata.CreateRules();

            Assert.AreEqual(6, rules.Count);
            var index = -1;

            foreach (var filter in rules.Cast <RowContentFilter>())
            {
                index++;
                Assert.AreEqual(_options[index / 3].Item1, filter.ExpectedContent);
                Assert.AreEqual(index % 3, filter.Count);
            }
        }
Пример #3
0
        public void CreateRulesWithSpecificContentWithoutSpecificCountTest()
        {
            var ruleMetdata = new RuleMetadata(_createDelegate, _options, true, false);

            Assert.IsTrue(ruleMetdata.NeedsSpecificContent);
            Assert.IsFalse(ruleMetdata.NeedsSpecificCount);
            var rules = ruleMetdata.CreateRules();

            Assert.AreEqual(2, rules.Count);
            Assert.IsInstanceOfType(rules[0], typeof(RowContentFilter));
            var filter0 = (RowContentFilter)rules[0];

            Assert.AreEqual(_options[0].Item1, filter0.ExpectedContent);
            Assert.IsNull(filter0.Count);

            Assert.IsInstanceOfType(rules[1], typeof(RowContentFilter));
            var filter1 = (RowContentFilter)rules[1];

            Assert.AreEqual(_options[1].Item1, filter1.ExpectedContent);
            Assert.IsNull(filter1.Count);
        }