示例#1
0
        public void MajorKnight_NotHit()
        {
            var rule   = new MajorKnight();
            var points = rule.ProcessRule(new List <int> {
                1, 2, 2, 1, 1, 1
            });

            Assert.Equal(0, points);
        }
示例#2
0
        public void MajorKnight_Hit()
        {
            var expectedPoints = 2200;
            var rule           = new MajorKnight();
            var points         = rule.ProcessRule(new List <int> {
                5, 5, 5, 5, 2, 1
            });

            Assert.Equal(expectedPoints, points);
        }
示例#3
0
        public int GetScore(List <int> values)
        {
            Rule initialRule = new MajorKnight();

            initialRule
            .SetNext(new Triplet(6))
            .SetNext(new Triplet(6))
            .SetNext(new Triplet(5))
            .SetNext(new Triplet(5))
            .SetNext(new Triplet(4))
            .SetNext(new Triplet(4))
            .SetNext(new Triplet(3))
            .SetNext(new Triplet(3))
            .SetNext(new Triplet(2))
            .SetNext(new Triplet(2))
            .SetNext(new Triplet(1, 1000))
            .SetNext(new Triplet(1, 1000))
            .SetNext(new Run())
            .SetNext(new CountN(5, 50))
            .SetNext(new CountN(1, 100));

            return(initialRule.ProcessRule(values));
        }