public void OptionsCtorTest() { var ruleMetdata = new RuleMetadata(_createDelegate, _options); Assert.AreSame(_createDelegate, ruleMetdata.Create); Assert.AreSame(_options, ruleMetdata.Options); Assert.IsTrue(ruleMetdata.NeedsSpecificContent); Assert.IsTrue(ruleMetdata.NeedsSpecificCount); }
public void DefaultCtorTest() { var ruleMetdata = new RuleMetadata(_createDelegate); Assert.AreSame(_createDelegate, ruleMetdata.Create); Assert.IsNull(ruleMetdata.Options); Assert.IsFalse(ruleMetdata.NeedsSpecificContent); Assert.IsFalse(ruleMetdata.NeedsSpecificCount); }
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); }
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); } }
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); }