public void Constructor ()
		{
			var sla = new StringLengthAttributePoker (10);

			Assert.AreEqual (10, sla.MaximumLength, "#A1-1");
			Assert.AreEqual (null, sla.ErrorMessage, "#A1-2");
			Assert.AreEqual ("The field {0} must be a string with a maximum length of {1}.", sla.GetErrorMessageString (), "#A1-3");
			Assert.AreEqual (0, sla.MinimumLength, "#A1-4");

			sla = new StringLengthAttributePoker (-10);
			Assert.AreEqual (-10, sla.MaximumLength, "#B1");
			sla = new StringLengthAttributePoker (0);
			Assert.AreEqual (0, sla.MaximumLength, "#C1");
		}
		public void Constructor ()
		{
			var sla = new StringLengthAttributePoker (10);

			Assert.AreEqual (10, sla.MaximumLength, "#A1-1");
			Assert.AreEqual (null, sla.ErrorMessage, "#A1-2");
			Assert.AreEqual ("The field {0} must be a string with a maximum length of {1}.", sla.GetErrorMessageString (), "#A1-3");
#if NET_4_0
			Assert.AreEqual (0, sla.MinimumLength, "#A1-4");

			sla = new StringLengthAttributePoker (-10);
			Assert.AreEqual (-10, sla.MaximumLength, "#B1");
#else
			AssertExtensions.Throws<ArgumentOutOfRangeException> (() => {
				sla = new StringLengthAttributePoker (-10);
			}, "#B1");
#endif
			sla = new StringLengthAttributePoker (0);
			Assert.AreEqual (0, sla.MaximumLength, "#C1");
		}
Beispiel #3
0
        public void Constructor()
        {
            var sla = new StringLengthAttributePoker(10);

            Assert.AreEqual(10, sla.MaximumLength, "#A1-1");
            Assert.AreEqual(null, sla.ErrorMessage, "#A1-2");
            Assert.AreEqual("The field {0} must be a string with a maximum length of {1}.", sla.GetErrorMessageString(), "#A1-3");
#if NET_4_0
            Assert.AreEqual(0, sla.MinimumLength, "#A1-4");

            sla = new StringLengthAttributePoker(-10);
            Assert.AreEqual(-10, sla.MaximumLength, "#B1");
#else
            AssertExtensions.Throws <ArgumentOutOfRangeException> (() =>
            {
                sla = new StringLengthAttributePoker(-10);
            }, "#B1");
#endif
            sla = new StringLengthAttributePoker(0);
            Assert.AreEqual(0, sla.MaximumLength, "#C1");
        }
Beispiel #4
0
        public void Constructor()
        {
            var sla = new StringLengthAttributePoker(10);

            Assert.AreEqual(10, sla.MaximumLength, "#A1-1");
            Assert.AreEqual(null, sla.ErrorMessage, "#A1-2");
            Assert.AreEqual("The field {0} must be a string with a maximum length of {1}.", sla.GetErrorMessageString(), "#A1-3");
            Assert.AreEqual(0, sla.MinimumLength, "#A1-4");

            sla = new StringLengthAttributePoker(-10);
            Assert.AreEqual(-10, sla.MaximumLength, "#B1");
            sla = new StringLengthAttributePoker(0);
            Assert.AreEqual(0, sla.MaximumLength, "#C1");
        }