示例#1
0
        public async Task Definition_IsInherited_Basic_Test()
        {
            var inheritedSetting = GetRequiredService <InheritedSetting>();

            var stoTenant = new InheritedSettingSto
            {
                InheritedTrue  = "Inherited_True_Tenant",
                InheritedFalse = "Inherited_False_Tenant"
            };

            stoTenant.SetSettingProviderName(TenantSettingValueProvider.ProviderName);
            await _settingModelManager.SaveAsync <InheritedSettingSto>(stoTenant);

            var stoGlobal = new InheritedSettingSto
            {
                InheritedTrue  = "Inherited_True_Global",
                InheritedFalse = "Inherited_False_Global"
            };

            stoGlobal.SetSettingProviderName(GlobalSettingValueProvider.ProviderName);
            await _settingModelManager.SaveAsync <InheritedSettingSto>(stoGlobal);

            inheritedSetting.InheritedTrue.ShouldBe(stoTenant.InheritedTrue);
            inheritedSetting.InheritedFalse.ShouldBeNull();

            inheritedSetting.SetValueProviderName(TenantSettingValueProvider.ProviderName);
            inheritedSetting.InheritedTrue.ShouldBe(stoTenant.InheritedTrue);
            inheritedSetting.InheritedFalse.ShouldBe(stoTenant.InheritedFalse);

            inheritedSetting.SetValueProviderName(GlobalSettingValueProvider.ProviderName);
            inheritedSetting.InheritedTrue.ShouldBe(stoGlobal.InheritedTrue);
            inheritedSetting.InheritedFalse.ShouldBe(stoGlobal.InheritedFalse);
        }
示例#2
0
        public async Task Definition_IsInherited_Test(string providerName)
        {
            var inheritedSetting = GetRequiredService <InheritedSetting>();
            var sto = new InheritedSettingSto
            {
                InheritedTrue  = "Inherited_True",
                InheritedFalse = "Inherited_False"
            };

            sto.SetSettingProviderName(providerName);
            await _settingModelManager.SaveAsync <InheritedSettingSto>(sto);

            inheritedSetting.InheritedTrue.ShouldBe(sto.InheritedTrue);
            inheritedSetting.InheritedFalse.ShouldBeNull();

            inheritedSetting.SetValueProviderName(providerName);
            inheritedSetting.InheritedTrue.ShouldBe(sto.InheritedTrue);
            inheritedSetting.InheritedFalse.ShouldBe(sto.InheritedFalse);
        }