コード例 #1
0
        public void RuleFor_TradingNameGreaterThan256_ErrorShouldOccur()
        {
            var organisation = GenerateOrganisation();

            organisation.TradingName = new string('a', 257);

            validator = new OrganisationDataValidator();

            var validationResult = validator.Validate(organisation);

            validationResult.IsValid.Should().BeFalse();
            validationResult.Errors.Count.Should().Be(1);
        }
コード例 #2
0
        public void RuleFor_RegistrationNumberLengthOutsideLimit_ErrorShouldOccur(string value)
        {
            var organisation = GenerateOrganisation();

            organisation.RegistrationNumber = value;

            validator = new OrganisationDataValidator();

            var validationResult = validator.Validate(organisation);

            validationResult.IsValid.Should().BeFalse();
            validationResult.Errors.Count.Should().Be(1);
        }
コード例 #3
0
        public void RuleFor_NameIsNullOrEmpty_ErrorShouldOccur(string value)
        {
            var organisation = GenerateOrganisation();

            organisation.Name = value;

            validator = new OrganisationDataValidator();

            var validationResult = validator.Validate(organisation);

            validationResult.IsValid.Should().BeFalse();
            validationResult.Errors.Count.Should().Be(1);
        }