Ejemplo n.º 1
0
        public void op_Match_string()
        {
            var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase)
            {
                new LexicalItem(NormalityComparer.Ordinal, "Example")
            };

            var expected = new LexicalMatch(obj.First());
            var actual   = obj.Match("EXAMPLE");

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 2
0
        public void op_MatchEnding_string()
        {
            var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase)
            {
                new LexicalItem(NormalityComparer.Ordinal, "Example")
            };

            var expected = new LexicalMatch(obj.First())
            {
                Prefix = "This is an"
            };
            var actual = obj.MatchEnding("This is an example");

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 3
0
        public void op_MatchBeginning_string()
        {
            var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase)
            {
                new LexicalItem(NormalityComparer.Ordinal, "Example")
            };

            var expected = new LexicalMatch(obj.First())
            {
                Suffix = "test case"
            };
            var actual = obj.MatchBeginning("example test case");

            Assert.Equal(expected, actual);
        }
Ejemplo n.º 4
0
        public void op_MatchEnding_string_whenShorterAndLonger()
        {
            var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase)
            {
                new LexicalItem(NormalityComparer.Ordinal, "two"),
                new LexicalItem(NormalityComparer.Ordinal, "two three")
            };

            var expected = new LexicalMatch(obj.Last())
            {
                Prefix = "1"
            };
            var actual = obj.MatchEnding("1 two three");

            Assert.Equal(expected, actual);
            Assert.Equal("1", actual.Prefix);
        }
Ejemplo n.º 5
0
        public void op_MatchBeginning_string_whenShorterAndLonger()
        {
            var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase)
            {
                new LexicalItem(NormalityComparer.Ordinal, "one"),
                new LexicalItem(NormalityComparer.Ordinal, "one two")
            };

            var expected = new LexicalMatch(obj.Last())
            {
                Suffix = "3"
            };
            var actual = obj.MatchBeginning("one two 3");

            Assert.Equal(expected, actual);
            Assert.Equal("3", actual.Suffix);
        }
Ejemplo n.º 6
0
        public void op_MatchWithin_string_whenLongerAndShorter()
        {
            var obj = new LexicalCollection(NormalityComparer.OrdinalIgnoreCase)
            {
                new LexicalItem(NormalityComparer.Ordinal, "two three"),
                new LexicalItem(NormalityComparer.Ordinal, "three")
            };

            var expected = new LexicalMatch(obj.First())
            {
                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);
        }