예제 #1
0
 internal void Parse()
 {
     Rules    = new MessageRules();
     Messages = new List <string>();
     foreach (var line in Readlines())
     {
         ParseLine(line);
     }
 }
예제 #2
0
        public void Test_Rules(string message, bool expectedMatch)
        {
            var rules = new MessageRules();

            rules.AddFollowingRule(0, new[] { 4, 1, 5 });
            rules.AddFollowingOrRule(1, new[] { 2, 3 }, new[] { 3, 2 });
            rules.AddFollowingOrRule(2, new[] { 4, 4 }, new[] { 5, 5 });
            rules.AddFollowingOrRule(3, new[] { 4, 5 }, new[] { 5, 4 });
            rules.AddConstantRule(4, 'a');
            rules.AddConstantRule(5, 'b');

            var result = rules.IsValid(message);

            Assert.AreEqual(expectedMatch, result);
        }
예제 #3
0
 public FollowingRule(MessageRules rulesCollection) : base(rulesCollection)
 {
 }
예제 #4
0
 public CharacterRule(MessageRules rulesCollection) : base(rulesCollection)
 {
 }
예제 #5
0
 public MessageRule(MessageRules rulesCollection)
 {
     RulesCollection = rulesCollection;
 }