Inheritance: IByConvention
コード例 #1
0
ファイル: TenantConvention.cs プロジェクト: frapid/frapid
 public static string GetDbNameByConvention(string domain = "")
 {
     var approved = GetSerializer();
     var convention = new ByConvention(Log.Logger, approved);
     string or = GetDomain();
     return convention.GetTenantName(domain, or);
 }
コード例 #2
0
ファイル: ByConventionTests.cs プロジェクト: frapid/frapid
        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);
        }
コード例 #3
0
ファイル: TenantConvention.cs プロジェクト: frapid/frapid
        public static ApprovedDomain FindDomainByTenant(string tenant)
        {
            var logger = Log.Logger;
            var serializer = GetSerializer();
            var convention = new ByConvention(logger, serializer);

            string defaultTenant = GetDefaultTenantName();

            var finder = new DomainFinder(serializer, convention);
            return finder.FindByTenant(tenant, defaultTenant);
        }
コード例 #4
0
ファイル: TenantValidatorTests.cs プロジェクト: frapid/frapid
        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);
        }
コード例 #5
0
ファイル: DomainFinderTests.cs プロジェクト: frapid/frapid
        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);
        }
コード例 #6
0
ファイル: TenantLocatorTests.cs プロジェクト: frapid/frapid
        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);
        }
コード例 #7
0
        public void TestGenerateMethod(string url, string expected)
        {
            var logger = new FakeLogger();
            var extractor = new DomainNameExtractor(logger);
            var serializer = new FakeDomainSerializer();
            var byConvention = new ByConvention(logger, serializer);
            var validator = new TenantValidator(logger, serializer, byConvention);
            const string defaultTenant = "localhost";


            var locator = new TenantLocator(logger, extractor, byConvention, validator, serializer);
            var uri = new Uri(url);
            var keyGen = new CacheKeyGenerator(uri, locator, defaultTenant);

            string result = keyGen.Generate();

            Assert.Equal(expected, result);
        }
コード例 #8
0
ファイル: TenantConvention.cs プロジェクト: frapid/frapid
        public static bool IsValidTenant(string tenant = "")
        {
            var logger = Log.Logger;
            var serializer = GetSerializer();
            var convention = new ByConvention(logger, serializer);

            var validator = new TenantValidator(logger, serializer, convention);
            return validator.IsValid(tenant);
        }
コード例 #9
0
ファイル: TenantConvention.cs プロジェクト: frapid/frapid
 public static ITenantLocator GetTenantLocator()
 {
     var logger = Log.Logger;
     var serializer = GetSerializer();
     var byConvention = new ByConvention(logger, serializer);
     var extractor = new DomainNameExtractor(logger);
     var validator = new TenantValidator(logger, serializer, byConvention);
     var investigator = new TenantLocator(logger, extractor, byConvention, validator, serializer);
     return investigator;
 }