Пример #1
0
        public void ValidatorTest(string domainName, bool expected)
        {
            var logger = new FakeLogger();
            var seriazlier = new FakeDomainSerializer();

            var validator = new DomainValidator(logger, seriazlier);
            bool result = validator.IsValid(domainName);

            Assert.Equal(expected, result);
        }
Пример #2
0
        public static bool IsValidDomain(string domain = "")
        {
            if(string.IsNullOrWhiteSpace(domain))
            {
                domain = GetDomain();
                Log.Verbose($"The empty domain was automatically resolved to \"{domain}\".");
            }

            var logger = Log.Logger;
            var serializer = GetSerializer();

            var validator = new DomainValidator(logger, serializer);
            return validator.IsValid(domain);
        }