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" }); }
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" }); }
public void MatchAllWildCardTest() { var wildcard = "*"; var result = Wildcard.ToRegexString(wildcard); Assert.AreEqual(@"\A.*?\Z", result); AssertWildcard(wildcard, new[] { "", "A", "123" }, new string[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" }); }
public void EmptyWildCardTest() { var wildcard = ""; var result = Wildcard.ToRegexString(wildcard); Assert.AreEqual(@"\A\Z", result); AssertWildcard(wildcard, new[] { "" }, new[] { "A", "123" }); }