public void CharInRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute('a', RangeBoundaryType.Inclusive, 'd', RangeBoundaryType.Exclusive);
            rangeClass.CharValue = 'c';
            List<ValidationError> errors = new List<ValidationError>();
            assertRange.Validate(rangeClass, charInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
        public void ByteOutOfRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute((byte)3, RangeBoundaryType.Inclusive, (byte)43, RangeBoundaryType.Exclusive);
            rangeClass.ByteValue = 2;
            List<ValidationError> errors = new List<ValidationError>();
            assertRange.Validate(rangeClass, byteInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
		public void Int32InRangeCausesError()
		{
			DenyRangeAttribute assertRange = new DenyRangeAttribute(3, RangeBoundaryType.Inclusive, 43, RangeBoundaryType.Exclusive);
			rangeClass.Int32Value = 25;
			List<ValidationError> errors = new List<ValidationError>();
			assertRange.Validate(rangeClass, int32Info, errors, ServiceProvider);

			Assert.AreEqual(1, errors.Count);
		}
Exemple #4
0
        public void DoubleInRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute(3D, RangeBoundaryType.Inclusive, 43D, RangeBoundaryType.Exclusive);

            rangeClass.DoubleValue = 25;
            List <ValidationError> errors = new List <ValidationError>();

            assertRange.Validate(rangeClass, doubleInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
Exemple #5
0
        public void Int32InRangeCausesError()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute(3, RangeBoundaryType.Inclusive, 43, RangeBoundaryType.Exclusive);

            rangeClass.Int32Value = 25;
            List <ValidationError> errors = new List <ValidationError>();

            assertRange.Validate(rangeClass, int32Info, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
Exemple #6
0
        public void StringInRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute("Anna", RangeBoundaryType.Inclusive, "Grace", RangeBoundaryType.Exclusive);

            rangeClass.StringValue = "Dee";
            List <ValidationError> errors = new List <ValidationError>();

            assertRange.Validate(rangeClass, stringInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
Exemple #7
0
        public void CharInRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute('a', RangeBoundaryType.Inclusive, 'd', RangeBoundaryType.Exclusive);

            rangeClass.CharValue = 'c';
            List <ValidationError> errors = new List <ValidationError>();

            assertRange.Validate(rangeClass, charInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
Exemple #8
0
        public void DecimalOutOfRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute((decimal)3, RangeBoundaryType.Inclusive, (decimal)43, RangeBoundaryType.Exclusive);

            rangeClass.DecimalValue = 2;
            List <ValidationError> errors = new List <ValidationError>();

            assertRange.Validate(rangeClass, decimalInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
Exemple #9
0
        public void ShortInRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute((Int16)3, RangeBoundaryType.Inclusive, (Int16)43, RangeBoundaryType.Exclusive);

            rangeClass.ShortValue = 25;
            List <ValidationError> errors = new List <ValidationError>();

            assertRange.Validate(rangeClass, shortInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
Exemple #10
0
        public void FloatOutOfRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute(3f, RangeBoundaryType.Inclusive, 43f, RangeBoundaryType.Exclusive);

            rangeClass.FloatValue = 2;
            List <ValidationError> errors = new List <ValidationError>();

            assertRange.Validate(rangeClass, floatInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
        public void DecimalInRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute((decimal)3, RangeBoundaryType.Inclusive, (decimal)43, RangeBoundaryType.Exclusive);
            rangeClass.DecimalValue = 25;
            List<ValidationError> errors = new List<ValidationError>();
            assertRange.Validate(rangeClass, decimalInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
        public void StringOutOfRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute("Anna", RangeBoundaryType.Inclusive, "Scott", RangeBoundaryType.Exclusive);
            rangeClass.StringValue = "Zeek";
            List<ValidationError> errors = new List<ValidationError>();
            assertRange.Validate(rangeClass, stringInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }
        public void FloatOutOfRangeTest()
        {
            DenyRangeAttribute assertRange = new DenyRangeAttribute(3f, RangeBoundaryType.Inclusive, 43f, RangeBoundaryType.Exclusive);
            rangeClass.FloatValue = 2;
            List<ValidationError> errors = new List<ValidationError>();
            assertRange.Validate(rangeClass, floatInfo, errors, ServiceProvider);

            Assert.AreEqual(1, errors.Count);
        }