Пример #1
0
        public virtual void TestCreateMatcherForSuffix()
        {
            string          pattern = "helloworld";
            FileNameMatcher matcher = new FileNameMatcher(pattern, null);

            matcher.Append("hello");
            FileNameMatcher childMatcher = matcher.CreateMatcherForSuffix();

            NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(false, childMatcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, childMatcher.CanAppendMatch());
            matcher.Append("world");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(false, childMatcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, childMatcher.CanAppendMatch());
            childMatcher.Append("world");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(true, childMatcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, childMatcher.CanAppendMatch());
            childMatcher.Reset();
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(false, childMatcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, childMatcher.CanAppendMatch());
            childMatcher.Append("world");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(true, childMatcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, childMatcher.CanAppendMatch());
        }
Пример #2
0
        public virtual void TestCopyConstructor()
        {
            string          pattern = "helloworld";
            FileNameMatcher matcher = new FileNameMatcher(pattern, null);

            matcher.Append("hello");
            FileNameMatcher copy = new FileNameMatcher(matcher);

            NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(false, copy.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, copy.CanAppendMatch());
            matcher.Append("world");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(false, copy.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, copy.CanAppendMatch());
            copy.Append("world");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(true, copy.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, copy.CanAppendMatch());
            copy.Reset();
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(false, copy.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, copy.CanAppendMatch());
            copy.Append("helloworld");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            NUnit.Framework.Assert.AreEqual(true, copy.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, copy.CanAppendMatch());
        }
Пример #3
0
		/// <exception cref="NGit.Errors.InvalidPatternException"></exception>
		private void AssertFileNameMatch(string pattern, string input, char excludedCharacter
			, bool matchExpected, bool appendCanMatchExpected)
		{
			FileNameMatcher matcher = new FileNameMatcher(pattern, excludedCharacter);
			matcher.Append(input);
			NUnit.Framework.Assert.AreEqual(matchExpected, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(appendCanMatchExpected, matcher.CanAppendMatch());
		}
Пример #4
0
		/// <exception cref="NGit.Errors.InvalidPatternException"></exception>
		private void AssertMatch(string pattern, string input, bool matchExpected, bool appendCanMatchExpected
			)
		{
			FileNameMatcher matcher = new FileNameMatcher(pattern, null);
			matcher.Append(input);
			Assert.AreEqual(matchExpected, matcher.IsMatch());
			Assert.AreEqual(appendCanMatchExpected, matcher.CanAppendMatch());
		}
Пример #5
0
        /// <exception cref="NGit.Errors.InvalidPatternException"></exception>
        private void AssertFileNameMatch(string pattern, string input, char excludedCharacter
                                         , bool matchExpected, bool appendCanMatchExpected)
        {
            FileNameMatcher matcher = new FileNameMatcher(pattern, excludedCharacter);

            matcher.Append(input);
            NUnit.Framework.Assert.AreEqual(matchExpected, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(appendCanMatchExpected, matcher.CanAppendMatch());
        }
Пример #6
0
        /// <exception cref="NGit.Errors.InvalidPatternException"></exception>
        private void AssertMatch(string pattern, string input, bool matchExpected, bool appendCanMatchExpected
                                 )
        {
            FileNameMatcher matcher = new FileNameMatcher(pattern, null);

            matcher.Append(input);
            Assert.AreEqual(matchExpected, matcher.IsMatch());
            Assert.AreEqual(appendCanMatchExpected, matcher.CanAppendMatch());
        }
Пример #7
0
        public virtual void TestReset()
        {
            string          pattern = "helloworld";
            FileNameMatcher matcher = new FileNameMatcher(pattern, null);

            matcher.Append("helloworld");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            matcher.Reset();
            matcher.Append("hello");
            NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(true, matcher.CanAppendMatch());
            matcher.Append("world");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            matcher.Append("to much");
            NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
            matcher.Reset();
            matcher.Append("helloworld");
            NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
            NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
        }
Пример #8
0
		public virtual void TestCopyConstructor()
		{
			string pattern = "helloworld";
			FileNameMatcher matcher = new FileNameMatcher(pattern, null);
			matcher.Append("hello");
			FileNameMatcher copy = new FileNameMatcher(matcher);
			NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(false, copy.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, copy.CanAppendMatch());
			matcher.Append("world");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(false, copy.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, copy.CanAppendMatch());
			copy.Append("world");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(true, copy.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, copy.CanAppendMatch());
			copy.Reset();
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(false, copy.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, copy.CanAppendMatch());
			copy.Append("helloworld");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(true, copy.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, copy.CanAppendMatch());
		}
Пример #9
0
		public virtual void TestCreateMatcherForSuffix()
		{
			string pattern = "helloworld";
			FileNameMatcher matcher = new FileNameMatcher(pattern, null);
			matcher.Append("hello");
			FileNameMatcher childMatcher = matcher.CreateMatcherForSuffix();
			NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(false, childMatcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, childMatcher.CanAppendMatch());
			matcher.Append("world");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(false, childMatcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, childMatcher.CanAppendMatch());
			childMatcher.Append("world");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(true, childMatcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, childMatcher.CanAppendMatch());
			childMatcher.Reset();
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(false, childMatcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, childMatcher.CanAppendMatch());
			childMatcher.Append("world");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			NUnit.Framework.Assert.AreEqual(true, childMatcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, childMatcher.CanAppendMatch());
		}
Пример #10
0
		public virtual void TestReset()
		{
			string pattern = "helloworld";
			FileNameMatcher matcher = new FileNameMatcher(pattern, null);
			matcher.Append("helloworld");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			matcher.Reset();
			matcher.Append("hello");
			NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(true, matcher.CanAppendMatch());
			matcher.Append("world");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			matcher.Append("to much");
			NUnit.Framework.Assert.AreEqual(false, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
			matcher.Reset();
			matcher.Append("helloworld");
			NUnit.Framework.Assert.AreEqual(true, matcher.IsMatch());
			NUnit.Framework.Assert.AreEqual(false, matcher.CanAppendMatch());
		}