Ejemplo n.º 1
0
        public async Task Should_Change_Feature_Value_And_Refresh_Cache()
        {
            var tenantId = Guid.NewGuid();

            //It is "False" at the beginning
            using (_currentTenant.Change(tenantId))
            {
                (await _featureChecker.IsEnabledAsync(TestFeatureDefinitionProvider.SocialLogins)).ShouldBeFalse();
            }

            //Set to "True" by host for the tenant
            using (_currentTenant.Change(null))
            {
                (await _featureChecker.IsEnabledAsync(TestFeatureDefinitionProvider.SocialLogins)).ShouldBeFalse();
                await _featureManager.SetForTenantAsync(tenantId, TestFeatureDefinitionProvider.SocialLogins, "True");

                (await _featureManager.GetOrNullForTenantAsync(TestFeatureDefinitionProvider.SocialLogins, tenantId)).ShouldBe("True");
            }

            //Now, it should be "True"
            using (_currentTenant.Change(tenantId))
            {
                (await _featureChecker.IsEnabledAsync(TestFeatureDefinitionProvider.SocialLogins)).ShouldBeTrue();
            }
        }
        public async Task UpdateAsync()
        {
            await _featureManager.SetForTenantAsync(Guid.NewGuid(), "MyApp.PdfReporting", true.ToString());

            await _featureManager.SetForUserAsync(Guid.NewGuid(), "MyApp.PdfReporting", true.ToString());
        }