public void op_ToString() { const string expected = "Example"; var actual = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, expected).ToString(); Assert.Equal(expected, actual); }
public void opImplicit_string_LexicalItem() { const string expected = "Example"; string actual = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, expected); Assert.Equal(expected, actual); }
public void op_MatchWithin_string_whenExactCanonical() { const string expected = "Example"; var obj = new LexicalItem(NormalityComparer.Ordinal, expected); var actual = obj.MatchWithin(expected); Assert.Equal(expected, actual); }
public void op_Match_string_whenOrdinalIgnoreCase() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example"); var expected = new LexicalMatch(obj); var actual = obj.Match("EXAMPLE"); Assert.Equal(expected, actual); }
public LexicalMatch(LexicalItem item) : this() { if (null == item) { throw new ArgumentNullException("item"); } Item = item; }
public void op_MatchWithin_string_whenBeginsWithCanonical() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "EXAMPLE"); var expected = new LexicalMatch(obj) { Suffix = "test case" }; var actual = obj.MatchWithin("example test case"); Assert.Equal(expected, actual); }
public void op_MatchEnding_string_whenContainsCanonical() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "EXAMPLE"); var expected = new LexicalMatch(obj) { Prefix = "This is an" }; var actual = obj.MatchEnding("This is an example"); Assert.Equal(expected, actual); }
public void op_MatchWithin_string_whenEndsWithCanonicalTwoWords() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "AN EXAMPLE"); var expected = new LexicalMatch(obj) { Prefix = "This is" }; var actual = obj.MatchWithin("This is an example"); Assert.Equal(expected, actual); }
public void op_Contains_string_whenMatchesSynonym() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example") { Synonyms = { "Foo", "Bar" } }; Assert.True(obj.Contains("Bar")); }
public void op_Contains_stringEmpty_whenSynonyms() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example") { Synonyms = { "Foo", "Bar" } }; Assert.False(obj.Contains(string.Empty)); }
public void op_Contains_stringNull_whenSynonyms() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example") { Synonyms = { "Foo", "Bar" } }; Assert.Throws <ArgumentNullException>(() => obj.Contains(null)); }
public void op_Match_stringEmpty_whenSynonyms() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example") { Synonyms = { "Foo", "Bar" } }; Assert.Null(obj.Match(string.Empty)); }
public void op_Contains_stringNull_whenSynonyms() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example") { Synonyms = { "Foo", "Bar" } }; Assert.Throws<ArgumentNullException>(() => obj.Contains(null)); }
public void op_MatchEnding_string_whenBadSpellingSynonym() { var obj = new LexicalItem(new UnderscoreComparer(), "example"); obj.Synonyms.Add("an example"); var expected = new LexicalMatch(obj) { Prefix = "This is" }; var actual = obj.MatchEnding("This is an ex_ample"); Assert.Equal(expected, actual); }
public void op_MatchBeginning_string_whenBadSpellingSynonym() { var obj = new LexicalItem(new UnderscoreComparer(), "example"); obj.Synonyms.Add("an example"); var expected = new LexicalMatch(obj) { Suffix = "test case" }; var actual = obj.MatchBeginning("an ex_ample test case"); Assert.Equal(expected, actual); }
public void op_MatchBeginning_string_whenContainsSynonym() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "ignore"); obj.Synonyms.Add("EXAMPLE"); var expected = new LexicalMatch(obj) { Suffix = "test case" }; var actual = obj.MatchBeginning("example test case"); Assert.Equal(expected, actual); }
public void op_Invoke_Func() { var obj = new LexicalItem(NormalityComparer.Ordinal, string.Concat("Foo", '\u00A0', "Bar")) { Synonyms = { string.Concat("Left", '\u00A0', "Right") } }; obj.Invoke(x => x.NormalizeWhiteSpace()); Assert.Equal("Foo Bar", obj.CanonicalForm); Assert.Equal("Left Right", obj.Synonyms.First()); }
public void op_Match_string_whenMatchesSynonym() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example") { Synonyms = { "Foo", "Bar" } }; var expected = new LexicalMatch(obj); var actual = obj.Match("Bar"); Assert.Equal(expected, actual); }
public void prop_Spellings() { var obj = new LexicalItem(NormalityComparer.Ordinal, "a") { Synonyms = { "b", "c" } }; const string expected = "abc"; var actual = obj .Spellings .Aggregate <string, string>(null, (x, spelling) => x + spelling); Assert.Equal(expected, actual); }
public void op_MatchWithin_string_whenBadSpellingSynonym() { var obj = new LexicalItem(new UnderscoreComparer(), "example"); obj.Synonyms.Add("an example"); var expected = new LexicalMatch(obj) { Prefix = "This is an", Suffix = "test case" }; var actual = obj.MatchWithin("This is an ex0ample test case"); Assert.Equal(expected, actual); }
public void op_Invoke_FuncNull() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws <ArgumentNullException>(() => obj.Invoke(null)); }
public void op_MatchBeginning_stringNull() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws<ArgumentNullException>(() => obj.MatchBeginning(null)); }
public void op_Contains_stringNull() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws <ArgumentNullException>(() => obj.Contains(null)); }
public void op_Contains_stringEmpty() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.False(obj.Contains(string.Empty)); }
public void op_MatchWithin_string_whenCaseDiffersCanonical() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Null(obj.MatchWithin("EXAMPLE")); }
public void op_Match_stringEmpty() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Null(obj.Match(string.Empty)); }
public void prop_Spellings() { var obj = new LexicalItem(NormalityComparer.Ordinal, "a") { Synonyms = { "b", "c" } }; const string expected = "abc"; var actual = obj .Spellings .Aggregate<string, string>(null, (x, spelling) => x + spelling); Assert.Equal(expected, actual); }
public void op_MatchWithin_string_whenContainsSynonym() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "ignore"); obj.Synonyms.Add("EXAMPLE"); var expected = new LexicalMatch(obj) { Prefix = "This is an", Suffix = "test case" }; var actual = obj.MatchWithin("This is an example test case"); Assert.Equal(expected, actual); }
public void op_Invoke_FuncNull() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws<ArgumentNullException>(() => obj.Invoke(null)); }
public void op_MatchBeginning_stringNull() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws <ArgumentNullException>(() => obj.MatchBeginning(null)); }
public void op_Contains_string_whenOrdinalIgnoreCase() { var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example"); Assert.True(obj.Contains("EXAMPLE")); }
public void op_MoveTo_LexiconNull_LexicalItem() { var obj = new LexicalCollection(NormalityComparer.Ordinal); var item = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws<ArgumentNullException>(() => obj.MoveTo(null, item)); }
public void op_Contains_stringNull() { var obj = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws<ArgumentNullException>(() => obj.Contains(null)); }
public void op_MoveTo_LexiconSame_LexicalItem() { var obj = new LexicalCollection(NormalityComparer.Ordinal); var item = new LexicalItem(NormalityComparer.Ordinal, "Example"); Assert.Throws<InvalidOperationException>(() => obj.MoveTo(obj, item)); }