예제 #1
0
        public void op_ToString()
        {
            const string expected = "Example";
            var          actual   = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, expected).ToString();

            Assert.Equal(expected, actual);
        }
예제 #2
0
        public void opImplicit_string_LexicalItem()
        {
            const string expected = "Example";
            string       actual   = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, expected);

            Assert.Equal(expected, actual);
        }
예제 #3
0
        public void opImplicit_string_LexicalItem()
        {
            const string expected = "Example";
            string actual = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, expected);

            Assert.Equal(expected, actual);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        public LexicalMatch(LexicalItem item)
            : this()
        {
            if (null == item)
            {
                throw new ArgumentNullException("item");
            }

            Item = item;
        }
예제 #7
0
        public LexicalMatch(LexicalItem item)
            : this()
        {
            if (null == item)
            {
                throw new ArgumentNullException("item");
            }

            Item = item;
        }
예제 #8
0
        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);
        }
예제 #9
0
        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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        public void op_Contains_string_whenMatchesSynonym()
        {
            var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example")
            {
                Synonyms =
                {
                    "Foo",
                    "Bar"
                }
            };

            Assert.True(obj.Contains("Bar"));
        }
예제 #12
0
        public void op_Contains_stringEmpty_whenSynonyms()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example")
            {
                Synonyms =
                {
                    "Foo",
                    "Bar"
                }
            };

            Assert.False(obj.Contains(string.Empty));
        }
예제 #13
0
        public void op_Contains_stringNull_whenSynonyms()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example")
            {
                Synonyms =
                {
                    "Foo",
                    "Bar"
                }
            };

            Assert.Throws <ArgumentNullException>(() => obj.Contains(null));
        }
예제 #14
0
        public void op_Match_stringEmpty_whenSynonyms()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example")
            {
                Synonyms =
                {
                    "Foo",
                    "Bar"
                }
            };

            Assert.Null(obj.Match(string.Empty));
        }
예제 #15
0
        public void op_Contains_stringEmpty_whenSynonyms()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example")
                          {
                              Synonyms =
                                  {
                                      "Foo",
                                      "Bar"
                                  }
                          };

            Assert.False(obj.Contains(string.Empty));
        }
예제 #16
0
        public void op_Contains_stringNull_whenSynonyms()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example")
                          {
                              Synonyms =
                                  {
                                      "Foo",
                                      "Bar"
                                  }
                          };

            Assert.Throws<ArgumentNullException>(() => obj.Contains(null));
        }
예제 #17
0
        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);
        }
예제 #18
0
        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);
        }
예제 #19
0
        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);
        }
예제 #20
0
        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());
        }
예제 #21
0
        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);
        }
예제 #22
0
        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);
        }
예제 #23
0
        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);
        }
예제 #24
0
        public void op_Invoke_FuncNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws <ArgumentNullException>(() => obj.Invoke(null));
        }
예제 #25
0
        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);
        }
예제 #26
0
        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);
        }
예제 #27
0
        public void op_MatchBeginning_stringNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws<ArgumentNullException>(() => obj.MatchBeginning(null));
        }
예제 #28
0
        public void op_Contains_stringNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws <ArgumentNullException>(() => obj.Contains(null));
        }
예제 #29
0
        public void op_Contains_stringEmpty()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.False(obj.Contains(string.Empty));
        }
예제 #30
0
        public void op_MatchWithin_string_whenCaseDiffersCanonical()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.MatchWithin("EXAMPLE"));
        }
예제 #31
0
        public void op_Match_stringEmpty()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.Match(string.Empty));
        }
예제 #32
0
        public void op_Match_stringEmpty()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.Match(string.Empty));
        }
예제 #33
0
        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);
        }
예제 #34
0
        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);
        }
예제 #35
0
        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);
        }
예제 #36
0
        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);
        }
예제 #37
0
        public void op_MatchWithin_string_whenCaseDiffersCanonical()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.MatchWithin("EXAMPLE"));
        }
예제 #38
0
        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());
        }
예제 #39
0
        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);
        }
예제 #40
0
        public void op_Invoke_FuncNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws<ArgumentNullException>(() => obj.Invoke(null));
        }
예제 #41
0
        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);
        }
예제 #42
0
        public void op_MatchBeginning_stringNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws <ArgumentNullException>(() => obj.MatchBeginning(null));
        }
예제 #43
0
        public void op_Match_stringEmpty_whenSynonyms()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example")
                          {
                              Synonyms =
                                  {
                                      "Foo",
                                      "Bar"
                                  }
                          };

            Assert.Null(obj.Match(string.Empty));
        }
예제 #44
0
        public void op_Contains_string_whenOrdinalIgnoreCase()
        {
            var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example");

            Assert.True(obj.Contains("EXAMPLE"));
        }
예제 #45
0
        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);
        }
예제 #46
0
        public void op_Contains_stringEmpty()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.False(obj.Contains(string.Empty));
        }
예제 #47
0
        public void op_ToString()
        {
            const string expected = "Example";
            var actual = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, expected).ToString();

            Assert.Equal(expected, actual);
        }
예제 #48
0
        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));
        }
예제 #49
0
        public void op_Contains_stringNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws<ArgumentNullException>(() => obj.Contains(null));
        }
예제 #50
0
        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));
        }
예제 #51
0
        public void op_Contains_string_whenMatchesSynonym()
        {
            var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example")
                          {
                              Synonyms =
                                  {
                                      "Foo",
                                      "Bar"
                                  }
                          };

            Assert.True(obj.Contains("Bar"));
        }
예제 #52
0
        public void op_Contains_string_whenOrdinalIgnoreCase()
        {
            var obj = new LexicalItem(NormalityComparer.OrdinalIgnoreCase, "Example");

            Assert.True(obj.Contains("EXAMPLE"));
        }