Esempio n. 1
0
        public void Consensus_Exact(int offset)
        {
            var rule = new ConsensusRule()
            {
                Rules = new ICustomRule[]
                {
                    new TestRule(RuleAction.Report, new FailurePart("bb", FailureClassification.Person, offset)),
                    new TestRule(RuleAction.Report, new FailurePart("bb", FailureClassification.Person, offset)),
                }
            };

            var result = rule.Apply("ff", "vv", out IEnumerable <FailurePart> badParts);

            Assert.AreEqual(RuleAction.Report, result);
            Assert.AreEqual(offset, badParts.Single().Offset);
        }
Esempio n. 2
0
        public void NoConsensus_OnlyOneHasProblem()
        {
            var rule = new ConsensusRule()
            {
                Rules = new ICustomRule[]
                {
                    new TestRule(RuleAction.Report, new FailurePart("bb", FailureClassification.Person)),
                    new TestRule(RuleAction.Ignore),
                }
            };

            var result = rule.Apply("ff", "vv", out IEnumerable <FailurePart> badParts);

            Assert.AreEqual(RuleAction.None, result);
            Assert.IsEmpty(badParts);
        }
Esempio n. 3
0
        public void Consensus_SingleOverlap()
        {
            var rule = new ConsensusRule()
            {
                Rules = new ICustomRule[]
                {
                    // Word is length 2 and begins at offset 10
                    new TestRule(RuleAction.Report, new FailurePart("ab", FailureClassification.Person, 10)),
                    new TestRule(RuleAction.Report, new FailurePart("bc", FailureClassification.Person, 11)),
                }
            };

            var result = rule.Apply("ff", "abc is so cool", out IEnumerable <FailurePart> badParts);

            Assert.AreEqual(RuleAction.Report, result);
            Assert.AreEqual(10, badParts.Single().Offset);
            Assert.AreEqual("ab", badParts.Single().Word);
        }