コード例 #1
0
        public virtual void testCreateMatcherForSuffix()
        {
            const string pattern = "helloworld";

            var matcher = new FileNameMatcher(pattern, null);

            matcher.Append("hello");

            FileNameMatcher childMatcher = matcher.CreateMatcherForSuffix();

            Assert.AreEqual(false, matcher.IsMatch());
            Assert.AreEqual(true, matcher.CanAppendMatch());
            Assert.AreEqual(false, childMatcher.IsMatch());
            Assert.AreEqual(true, childMatcher.CanAppendMatch());
            matcher.Append("world");
            Assert.AreEqual(true, matcher.IsMatch());
            Assert.AreEqual(false, matcher.CanAppendMatch());
            Assert.AreEqual(false, childMatcher.IsMatch());
            Assert.AreEqual(true, childMatcher.CanAppendMatch());
            childMatcher.Append("world");
            Assert.AreEqual(true, matcher.IsMatch());
            Assert.AreEqual(false, matcher.CanAppendMatch());
            Assert.AreEqual(true, childMatcher.IsMatch());
            Assert.AreEqual(false, childMatcher.CanAppendMatch());
            childMatcher.Reset();
            Assert.AreEqual(true, matcher.IsMatch());
            Assert.AreEqual(false, matcher.CanAppendMatch());
            Assert.AreEqual(false, childMatcher.IsMatch());
            Assert.AreEqual(true, childMatcher.CanAppendMatch());
            childMatcher.Append("world");
            Assert.AreEqual(true, matcher.IsMatch());
            Assert.AreEqual(false, matcher.CanAppendMatch());
            Assert.AreEqual(true, childMatcher.IsMatch());
            Assert.AreEqual(false, childMatcher.CanAppendMatch());
        }