示例#1
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);
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
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);
        }
示例#8
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);
        }
示例#9
0
        public void op_MatchWithin_string_whenCaseDiffersCanonical()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.MatchWithin("EXAMPLE"));
        }
示例#10
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);
        }
示例#11
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);
        }
示例#12
0
        public void op_MatchWithin_stringNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws<ArgumentNullException>(() => obj.MatchWithin(null));
        }
示例#13
0
        public void op_MatchWithin_stringEmpty()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.MatchWithin(string.Empty));
        }
示例#14
0
        public void op_MatchWithin_string_whenCaseDiffersCanonical()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.MatchWithin("EXAMPLE"));
        }
示例#15
0
        public void op_MatchWithin_stringNull()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Throws <ArgumentNullException>(() => obj.MatchWithin(null));
        }
示例#16
0
        public void op_MatchWithin_stringEmpty()
        {
            var obj = new LexicalItem(NormalityComparer.Ordinal, "Example");

            Assert.Null(obj.MatchWithin(string.Empty));
        }