Ejemplo n.º 1
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());
        }
Ejemplo n.º 2
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());
        }
Ejemplo n.º 3
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());
        }
Ejemplo n.º 4
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());
		}
Ejemplo n.º 5
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());
		}