Inheritance: IDomainSerializer
Example #1
0
        public void CheckIfStaticDomainTest(string domain, bool isStatic)
        {
            var logger = new FakeLogger();
            var serializer = new FakeDomainSerializer();

            var check = new StaticDomainCheck(logger, serializer);
            bool result = check.IsStaticDomain(domain);

            Assert.Equal(isStatic, result);
        }
Example #2
0
        public void CheckIfSslIsEnforcedTest(string domain, bool shouldBeEnforced)
        {
            var logger = new FakeLogger();
            var serializer = new FakeDomainSerializer();

            var check = new SslDomainCheck(logger, serializer);
            bool result = check.EnforceSsl(domain);

            Assert.Equal(shouldBeEnforced, result);
        }
Example #3
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);
        }
Example #4
0
        public void TestOrConvention(string domain, string or, string expected)
        {
            var logger = new FakeLogger();
            var serializer = new FakeDomainSerializer();

            var convention = new ByConvention(logger, serializer);
            string result = convention.GetTenantName(domain, or);

            Assert.Equal(expected, result);
        }
Example #5
0
        public void ValidatorTest(string tenantName, bool expected)
        {
            var logger = new FakeLogger();
            var seriazlier = new FakeDomainSerializer();
            var convention = new ByConvention(logger, seriazlier);

            var validator = new TenantValidator(logger, seriazlier, convention);
            bool result = validator.IsValid(tenantName);

            Assert.Equal(expected, result);
        }
Example #6
0
        public void ShouldLocateDomainWithoutSchemeTest()
        {
            var domains = new FakeDomainSerializer();
            var locator = new BaseDomainLocator(domains);
            string domain = "www.example.com";

            string expected = "example.com";
            string result = locator.Get(domain, false, false);

            Assert.Equal(expected, result);
        }
Example #7
0
        public void ShouldFindDomainByTenantName(string defaultSite, string synonym, string expectedDomain)
        {
            var logger = new FakeLogger();
            var serializer = new FakeDomainSerializer();
            var convention = new ByConvention(logger, serializer);

            var finder = new DomainFinder(serializer, convention);

            var found = finder.FindBySynonym(synonym, defaultSite);
            string result = found.DomainName;

            Assert.Equal(expectedDomain, result);
        }
Example #8
0
        public void TestConvention(string url, string expected)
        {
            string defaultTenant = "localhost";
            var logger = new FakeLogger();
            var serializer = new FakeDomainSerializer();
            var extractor = new DomainNameExtractor(logger);
            var convention = new ByConvention(logger, serializer);
            var validator = new TenantValidator(logger, serializer, convention);

            var locator = new TenantLocator(logger, extractor, convention, validator, serializer);

            string result = locator.FromUrl(url, defaultTenant);

            Assert.Equal(expected, result);
        }