public void GetMatchesFindsNoMatchesForEmpty() { LookBackExpression<char> expression = new LookBackExpression<char> (m_any); var matches = expression.GetMatches (EmptyList, 0); Assert.AreEqual (0, matches.Count (), "Count"); }
public void GetMatchesFindsOneMatchForA() { LookBackExpression<char> expression = new LookBackExpression<char> (m_A); string [] expectedValues = new [] {""}; int index = 1; var list = AList; var matches = expression.GetMatches (list, index).ToList (); Assert.AreEqual (expectedValues.Length, matches.Count (), "Count"); for (int i = 0; i < expectedValues.Length; i++) { var match = matches [i]; var expected = expectedValues [i]; Assert.AreEqual (index, match.Index, "match.Index"); Assert.AreEqual (expected.Length, match.Length, "match.Length"); Assert.IsTrue (match.Success, "match.Success"); Assert.AreEqual (expected.Length, match.Items.Count, "match.Items.Count"); Assert.AreEqual (expected, new string (match.Items.ToArray ()), "match.Items"); } }