public void FailIfRidgidPositiveIntegerAttributeHasWrongType()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            Should.Throw <ShouldAssertException>(() => model.ShouldValidateTheseFields(
                                                     new List <RidgidFieldValidation>
            {
                new RidgidPositiveIntegerFieldValidation
                {
                    ErrorId   = 2,
                    FieldName = nameof(model.ProductId)
                }
            }));
        }
        public void FailIfRidgidEmailAddressAttributeHasWrongErrorId()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            Should.Throw <ShouldAssertException>(() => model.ShouldValidateTheseFields(
                                                     new List <RidgidFieldValidation>
            {
                new RidgidEmailAddressFieldValidation
                {
                    ErrorId   = 2,
                    FieldName = nameof(model.Email)
                }
            }));
        }
        public void FailIfRidgidIso8601DateTimeHasWrongErrorId()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            Should.Throw <ShouldAssertException>(() => model.ShouldValidateTheseFields(
                                                     new List <RidgidFieldValidation>
            {
                new RidgidIso8601DateTimeFieldValidation
                {
                    ErrorId   = 2,
                    FieldName = nameof(model.StartDate)
                }
            }));
        }
        public void PassIfRidgidPositiveIntegerAttributeMatches()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            model.ShouldValidateTheseFields(
                new List <RidgidFieldValidation>
            {
                new RidgidPositiveIntegerFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ActualErrorMessage",
                    FieldName    = nameof(model.ProductId)
                }
            });
        }
        public void PassIfRidgidEmailAddressMatches()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            model.ShouldValidateTheseFields(
                new List <RidgidFieldValidation>
            {
                new RidgidEmailAddressFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ActualErrorMessage",
                    FieldName    = nameof(model.Email)
                }
            });
        }
        public void FailIfRidgidRangeAttributeHasWrongType()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            Should.Throw <ShouldAssertException>(() => model.ShouldValidateTheseFields(
                                                     new List <RidgidFieldValidation>
            {
                new RidgidRangeFieldValidation
                {
                    ErrorId   = 2,
                    FieldName = nameof(model.Range),
                    Type      = typeof(decimal)
                }
            }));
        }
        public void FailIfRidgidStringLengthAttributeHasWrongErrorMessage()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            Should.Throw <ShouldAssertException>(() => model.ShouldValidateTheseFields(
                                                     new List <RidgidFieldValidation>
            {
                new RidgidStringLengthFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ExpectedErrorMessage",
                    FieldName    = nameof(model.StringLength),
                }
            }));
        }
        public void PassIfRidgidRequiredAttributeMatches()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            model.ShouldValidateTheseFields(
                new List <RidgidFieldValidation>
            {
                new RidgidRequiredFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ActualErrorMessage",
                    FieldName    = nameof(model.Required),
                }
            });
        }
        public void FailIfRidgidRegularExpressionAttributeHasWrongRegex()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            Should.Throw <ShouldAssertException>(() => model.ShouldValidateTheseFields(
                                                     new List <RidgidFieldValidation>
            {
                new RidgidRegularExpressionFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ActualErrorMessage",
                    FieldName    = nameof(model.RegularExpression),
                    Regex        = "wrongregex"
                }
            }));
        }
        public void FailIfRidgidRangeAttributeHasWrongMininum()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            Should.Throw <ShouldAssertException>(() => model.ShouldValidateTheseFields(
                                                     new List <RidgidFieldValidation>
            {
                new RidgidRangeFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ExpectedErrorMessage",
                    FieldName    = nameof(model.Range),
                    Type         = typeof(int),
                    Mininum      = "0"
                }
            }));
        }
        public void PassIfRidgidStringLengthAttributeMatches()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            model.ShouldValidateTheseFields(
                new List <RidgidFieldValidation>
            {
                new RidgidStringLengthFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ActualErrorMessage",
                    FieldName    = nameof(model.StringLength),
                    MinLength    = 1,
                    MaxLength    = 2
                }
            });
        }
        public void PassIfRidgidRangeAttributeMatches()
        {
            //--Arrange
            var model = new ShouldValidateExtensionTestModel();

            //--Act
            model.ShouldValidateTheseFields(
                new List <RidgidFieldValidation>
            {
                new RidgidRangeFieldValidation
                {
                    ErrorId      = 1,
                    ErrorMessage = "ActualErrorMessage",
                    FieldName    = nameof(model.Range),
                    Type         = typeof(int),
                    Mininum      = "1",
                    Maximum      = "2"
                }
            });
        }