コード例 #1
0
        public void MatchContainsTest()
        {
            var wildcard = "*abc*";
            var result   = Wildcard.ToRegexString(wildcard);

            Assert.AreEqual(@"\A.*?abc.*?\Z", result);
            AssertWildcard(wildcard, new[] { "abc", "0abc", "abc0", "0abc0" }, new[] { "a0b0c", "123A", "GG" });
        }
コード例 #2
0
        public void MatchEndTest()
        {
            var wildcard = "*123";
            var result   = Wildcard.ToRegexString(wildcard);

            Assert.AreEqual(@"\A.*?123\Z", result);
            AssertWildcard(wildcard, new[] { "123", "0123" }, new[] { "1234", "123A", "GG" });
        }
コード例 #3
0
        public void MatchAllWildCardTest()
        {
            var wildcard = "*";
            var result   = Wildcard.ToRegexString(wildcard);

            Assert.AreEqual(@"\A.*?\Z", result);
            AssertWildcard(wildcard, new[] { "", "A", "123" }, new string[0]);
        }
コード例 #4
0
        public void MatchStartTest()
        {
            var wildcard = "123*";
            var result   = Wildcard.ToRegexString(wildcard);

            Assert.AreEqual(@"\A123.*?\Z", result);
            AssertWildcard(wildcard, new[] { "123", "1234" }, new[] { "12", "A123", "GG" });
        }
コード例 #5
0
        public void EmptyWildCardTest()
        {
            var wildcard = "";
            var result   = Wildcard.ToRegexString(wildcard);

            Assert.AreEqual(@"\A\Z", result);
            AssertWildcard(wildcard, new[] { "" }, new[] { "A", "123" });
        }