示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserValidator"/> class.
 /// </summary>
 /// <param name="userTeamMembershipRepository">The user team membership repository.</param>
 /// <param name="tenantValidator">The tenant validator service.</param>
 public UserValidator(
     UserTeamMembershipRepository userTeamMembershipRepository,
     TenantValidator tenantValidator)
 {
     this.userTeamMembershipRepository = userTeamMembershipRepository;
     this.tenantValidator = tenantValidator;
 }
示例#2
0
        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));
        }
示例#3
0
        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);
        }
示例#4
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);
        }
示例#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);
        }
示例#6
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);
        }
示例#7
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);
        }
示例#8
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);
        }
        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);
        }
示例#10
0
 /// <inheritdoc />
 public TenantManager(
     TenantCatalogDbContext <Tenant, string> dbContext,
     TenantValidator <Tenant, string> validator)
     : base(dbContext, validator)
 {
 }
示例#11
0
        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);
        }
示例#12
0
 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;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CelebrationBotFilterMiddleware"/> class.
 /// </summary>
 /// <param name="tenantValidator">ASP.NET Core <see cref="IConfiguration"/> instance.</param>
 public CelebrationBotFilterMiddleware(TenantValidator tenantValidator)
 {
     this.tenantValidator = tenantValidator;
 }
        public ValidationResult Validate(Tenant tenant)
        {
            var validator = new TenantValidator();

            return(validator.Validate(tenant));
        }