public void Test_StrictCasing()
		{
			RegexSpecification s = new RegexSpecification("Foo", false, false);
			Assert.IsFalse(s.Test("").Success);
			Assert.IsFalse(s.Test("a").Success);
			Assert.IsFalse(s.Test(null).Success);
			Assert.IsFalse(s.Test("foo").Success);
			Assert.IsTrue(s.Test("Foo").Success);
		}
        public void ReasonForDissatisfactionIsSet()
        {
            const string value = "A";
            sut = new RegexSpecification(RegexPattern, ReasonForDissatisfaction);

            sut.IsSatisfiedBy(value);

            Assert.AreEqual(string.Format(ReasonForDissatisfaction, value), sut.ReasonsForDissatisfaction.Single());
        }
Exemple #3
0
        public void Test_StrictCasing()
        {
            RegexSpecification s = new RegexSpecification("Foo", false, false);

            Assert.IsFalse(s.Test("").Success);
            Assert.IsFalse(s.Test("a").Success);
            Assert.IsFalse(s.Test(null).Success);
            Assert.IsFalse(s.Test("foo").Success);
            Assert.IsTrue(s.Test("Foo").Success);
        }
		public void Test_NullMatches()
		{
			RegexSpecification s = new RegexSpecification("Foo", false, true);
			Assert.IsFalse(s.Test("a").Success);
			Assert.IsFalse(s.Test("foo").Success);
			Assert.IsTrue(s.Test("Foo").Success);

			Assert.IsTrue(s.Test(null).Success);

			//TODO: it would seem that this test ought to succeed - consider changing this behaviour
			Assert.IsFalse(s.Test("").Success);
		}
        public void Test_Regex_Options2()
        {
            ISpecification s = _factory.GetSpecification("regex_options2");

            Assert.IsInstanceOfType(typeof(RegexSpecification), s);

            RegexSpecification s1 = (RegexSpecification)s;

            Assert.AreEqual("XXX", s1.Pattern);
            Assert.AreEqual(true, s1.NullMatches);
            Assert.AreEqual(true, s1.IgnoreCase);
        }
Exemple #6
0
        public void Test_NullMatches()
        {
            RegexSpecification s = new RegexSpecification("Foo", false, true);

            Assert.IsFalse(s.Test("a").Success);
            Assert.IsFalse(s.Test("foo").Success);
            Assert.IsTrue(s.Test("Foo").Success);

            Assert.IsTrue(s.Test(null).Success);

            //TODO: it would seem that this test ought to succeed - consider changing this behaviour
            Assert.IsFalse(s.Test("").Success);
        }
		public void Test_InvalidType()
		{
			RegexSpecification s = new RegexSpecification("Foo", false, false);
			Assert.IsFalse(s.Test(1).Success);
		}
        public void NullIsNotSatisfactory()
        {
            sut = new RegexSpecification(RegexPattern, ReasonForDissatisfaction);

            Assert.IsFalse(sut.IsSatisfiedBy(null));
        }
        public void IsNotSatisfiedWhenRegexIsNotMatched()
        {
            sut = new RegexSpecification(RegexPattern, ReasonForDissatisfaction);

            Assert.IsFalse(sut.IsSatisfiedBy("A"));
        }
Exemple #10
0
        public void Test_InvalidType()
        {
            RegexSpecification s = new RegexSpecification("Foo", false, false);

            Assert.IsFalse(s.Test(1).Success);
        }