public void IsMessageValid_Works_Correctly01(string message, bool result) { const string data = @" 0: 1 2 1: ""a"" 2: 1 3 | 3 1 3: ""b"""; var rules = RulesParser.Parse(data); Assert.That(Solver.IsMessageValid(rules[0], message), Is.EqualTo(result)); }
public void IsMessageValid_Works_Correctly02(string message, bool result) { const string data = @" 0: 4 1 5 1: 2 3 | 3 2 2: 4 4 | 5 5 3: 4 5 | 5 4 4: ""a"" 5: ""b"""; var rules = RulesParser.Parse(data); Assert.That(Solver.IsMessageValid(rules[0], message), Is.EqualTo(result)); }
public void Parse_Works_Correctly() { const string data = @" 0: 1 2 1: ""a"" 2: 1 3 | 3 1 3 3: ""b"""; var rules = RulesParser.Parse(data); Assert.That(rules.Count, Is.EqualTo(4)); Assert.That(rules[0], Is.TypeOf <Complex>()); Assert.That(rules[1], Is.TypeOf <Simple>()); Assert.That(rules[2], Is.TypeOf <Complex>()); Assert.That(rules[3], Is.TypeOf <Simple>()); Assert.That(rules[1].Length, Is.EqualTo(1)); Assert.That(rules[3].Length, Is.EqualTo(1)); Assert.That(rules[2].Length, Is.EqualTo(3)); Assert.That(rules[0].Length, Is.EqualTo(4)); }