Exemplo n.º 1
0
        private void ExecuteErrorResultTests()
        {
            var validator = new NumberPropertyValidator();
            // Act
            var actualResult = validator.Validate(
                _property,
                new List <WorkflowPropertyType>()
            {
                _propertyType
            },
                new ValidationContext(new List <SqlUser>(), new List <SqlGroup>()));

            // Assert
            Assert.AreEqual(actualResult.ErrorCode, ErrorCodes.InvalidArtifactProperty,
                            "Error code is not InvalidArtifactProperty");
        }
Exemplo n.º 2
0
        public void Validate_DefaultNumberProperty_Success()
        {
            // Arrange.
            var validator = new NumberPropertyValidator();

            // Act.
            var actualResult = validator.Validate(
                _property,
                new List <WorkflowPropertyType>()
            {
                _propertyType
            },
                new ValidationContext(new List <SqlUser>(), new List <SqlGroup>()));

            // Assert.
            Assert.AreEqual(actualResult, null, "There should not be validation errors.");
        }
Exemplo n.º 3
0
        public void Validate_DoNotValidateNumberLessThanRange_Success()
        {
            // Arrange.
            var validator = new NumberPropertyValidator();

            _propertyType.IsValidate = false;
            _property.NumberValue    = _propertyType.Range.Start - 1;
            // Act.
            var actualResult = validator.Validate(
                _property,
                new List <WorkflowPropertyType>()
            {
                _propertyType
            },
                new ValidationContext(new List <SqlUser>(), new List <SqlGroup>()));

            // Assert.
            Assert.AreEqual(actualResult, null, "There should not be validation errors.");
        }
Exemplo n.º 4
0
        public void Validate_DoNotValidateMoreThanDecimalPlaces_Success()
        {
            // Arrange.
            var validator = new NumberPropertyValidator();

            _propertyType.IsValidate    = false;
            _propertyType.DecimalPlaces = 2;
            _property.NumberValue       = (decimal)1.1234567890;
            // Act.
            var actualResult = validator.Validate(
                _property,
                new List <WorkflowPropertyType>()
            {
                _propertyType
            },
                new ValidationContext(new List <SqlUser>(), new List <SqlGroup>()));

            // Assert.
            Assert.AreEqual(actualResult, null, "There should not be validation errors.");
        }