public void SubTypeShouldErrorWithInvalidValue(int?val)
        {
            // Arrange
            var model = new ContactInformation()
            {
                SubType = (SubType)val
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldHaveValidationErrorFor(x => x.SubType);
        }
        public void ValueShouldErrorWithNoValue(string invalid)
        {
            // Arrange
            var model = new ContactInformation()
            {
                Value = invalid
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldHaveValidationErrorFor(x => x.Value);
        }
        public void SubTypeShouldNotErrorWithValidValue(SubType?valid)
        {
            // Arrange
            var model = new ContactInformation()
            {
                SubType = valid
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldNotHaveValidationErrorFor(x => x.SubType);
        }
        public void DescriptionShouldNotErrorValidValue(string valid)
        {
            // Arrange
            var model = new ContactInformation()
            {
                Description = valid
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldNotHaveValidationErrorFor(x => x.Description);
        }
        public void DescriptionShouldErrorWithWithTagsInValue()
        {
            // Arrange
            var model = new ContactInformation()
            {
                Description = StringWithTags
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldHaveValidationErrorFor(x => x.Description)
            .WithErrorCode(ErrorCodes.XssCheckFailure);
        }
        public void ValueShouldNotErrorWithWhenContactTypeIsAddress()
        {
            // Arrange
            var model = new ContactInformation()
            {
                Value       = null,
                ContactType = ContactType.address
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldNotHaveValidationErrorFor(x => x.Value);
        }
        public void ValueShouldNotErrorWithValidPhoneNumber(string valid)
        {
            // Arrange
            var model = new ContactInformation()
            {
                Value       = valid,
                ContactType = ContactType.phone
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldNotHaveValidationErrorFor(x => x.Value);
        }
        public void ValueShouldNotErrorWithValidEmail()
        {
            // Arrange
            var model = new ContactInformation()
            {
                Value       = "*****@*****.**",
                ContactType = ContactType.email
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldNotHaveValidationErrorFor(x => x.Value);
        }
        public void ValueShouldErrorWithInvalidPhoneNumber(string invalid)
        {
            // Arrange
            var model = new ContactInformation()
            {
                Value       = invalid,
                ContactType = ContactType.phone
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldHaveValidationErrorFor(x => x.Value)
            .WithErrorCode(ErrorCodes.InvalidPhoneNumber);
        }
        public void AddressExtendedShouldErrorWithInvalidValue()
        {
            // Arrange
            var invalidAddressExtended = new AddressExtended()
            {
                UPRN = StringWithTags
            };
            var model = new ContactInformation()
            {
                AddressExtended = invalidAddressExtended
            };

            // Act
            var result = _sut.TestValidate(model);

            // Assert
            result.ShouldHaveValidationErrorFor(x => x.AddressExtended.UPRN)
            .WithErrorCode(ErrorCodes.XssCheckFailure);
        }