Пример #1
0
		public void ConstuctorWithStringEmpty()
		{
			var comparer = new RegexComparer(new Regex(String.Empty));

			Assert.IsTrue(comparer.Compare(String.Empty), "String.Empty should match");
			Assert.IsTrue(comparer.Compare(" "), "Any string should not match");

			Assert.IsFalse(comparer.Compare(null), "null should not match");
		}
Пример #2
0
		public void ConstructorWithValue()
		{
			var comparer = new RegexComparer(new Regex("^A test value$"));

			Assert.IsTrue(comparer.Compare("A test value"), "Exact match should pass.");

			Assert.IsFalse(comparer.Compare("a test Value"), "Match should be case sensitive");
			Assert.IsFalse(comparer.Compare("A test value 2"), "Exact match plus more should not pass.");
			Assert.IsFalse(comparer.Compare("test"), "Partial match should not match");
			Assert.IsFalse(comparer.Compare("completely different"), "Something completely different should not match");
			Assert.IsFalse(comparer.Compare(String.Empty), "String.Empty should not match");
			Assert.IsFalse(comparer.Compare(null), "null should not match");
		}