public void ValidateValidDigitalOceanDomain() { DigitalOceanDomain domain = new DigitalOceanDomain { Name = "test.com", Records = ValidDNSRecordCollection() }; IValidator <DigitalOceanDomain> validator = new DigitalOceanDomainValidator(); ValidationResult validationResult = validator.Validate(domain); Assert.True(validationResult.IsValid); }
public void InvalidDigitalOceanDomain() { DigitalOceanDomain domain = new DigitalOceanDomain { Name = string.Empty, Records = ValidDNSRecordCollection() }; IValidator <DigitalOceanDomain> validator = new DigitalOceanDomainValidator(); ValidationResult validationResult = validator.Validate(domain); Assert.False(validationResult.IsValid); Assert.True(validationResult.Errors.All(m => m.ErrorMessage.Equals(DigitalOceanDomainValidator.NameErrorMessage))); }