public void op_MatchWithin_stringEmpty() { var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase) { new LexicalItem(NormalityComparer.Ordinal, "Example") }; Assert.Null(obj.MatchWithin(string.Empty)); }
public void op_MatchWithin_stringNull() { var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase) { new LexicalItem(NormalityComparer.Ordinal, "Example") }; Assert.Throws <ArgumentNullException>(() => obj.MatchWithin(null)); }
public void op_MatchWithin_string() { var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase) { new LexicalItem(NormalityComparer.Ordinal, "Example") }; var expected = new LexicalMatch(obj.First()) { Prefix = "This is an", Suffix = "test case" }; var actual = obj.MatchWithin("This is an example test case"); Assert.Equal(expected, actual); }
public void op_MatchWithin_string_whenShorterAndLonger() { var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase) { new LexicalItem(NormalityComparer.Ordinal, "three"), new LexicalItem(NormalityComparer.Ordinal, "two three") }; var expected = new LexicalMatch(obj.Last()) { Prefix = "1", Suffix = "4" }; var actual = obj.MatchWithin("1 two three 4"); Assert.Equal(expected, actual); Assert.Equal("1", actual.Prefix); Assert.Equal("4", actual.Suffix); }