public virtual void testReset() { const string pattern = "helloworld"; var matcher = new FileNameMatcher(pattern, null); matcher.Append("helloworld"); Assert.AreEqual(true, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); matcher.Reset(); matcher.Append("hello"); Assert.AreEqual(false, matcher.IsMatch()); Assert.AreEqual(true, matcher.CanAppendMatch()); matcher.Append("world"); Assert.AreEqual(true, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); matcher.Append("to much"); Assert.AreEqual(false, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); matcher.Reset(); matcher.Append("helloworld"); Assert.AreEqual(true, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); }
public virtual void testCopyConstructor() { const string pattern = "helloworld"; var matcher = new FileNameMatcher(pattern, null); matcher.Append("hello"); var copy = new FileNameMatcher(matcher); Assert.AreEqual(false, matcher.IsMatch()); Assert.AreEqual(true, matcher.CanAppendMatch()); Assert.AreEqual(false, copy.IsMatch()); Assert.AreEqual(true, copy.CanAppendMatch()); matcher.Append("world"); Assert.AreEqual(true, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); Assert.AreEqual(false, copy.IsMatch()); Assert.AreEqual(true, copy.CanAppendMatch()); copy.Append("world"); Assert.AreEqual(true, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); Assert.AreEqual(true, copy.IsMatch()); Assert.AreEqual(false, copy.CanAppendMatch()); copy.Reset(); Assert.AreEqual(true, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); Assert.AreEqual(false, copy.IsMatch()); Assert.AreEqual(true, copy.CanAppendMatch()); copy.Append("helloworld"); Assert.AreEqual(true, matcher.IsMatch()); Assert.AreEqual(false, matcher.CanAppendMatch()); Assert.AreEqual(true, copy.IsMatch()); Assert.AreEqual(false, copy.CanAppendMatch()); }