public async Task <T> GetAsync <T>(string name) { var setting = _definitionManager.Get(name) as SettingDefinition <T>; var providers = _providerManager.Providers.Reverse(); var value = await GetValueFromProvidersAsync(providers, setting); return(value); }
public async Task GetOrNullAsync() { var mySetting3 = _settingDefinitionManager.Get("MySetting3"); var defaultValueSettingManagementProvider = new DefaultValueSettingManagementProvider(); (await defaultValueSettingManagementProvider .GetOrNullAsync(mySetting3, DefaultValueSettingValueProvider.ProviderName)).ShouldBe("123"); }
public void Definition_Localization_Test(string propName) { var settingType = typeof(ComplexSetting); var prop = settingType.GetProperties().First(w => w.Name == propName); var sd = _settingDefinitionManager.Get(prop.GetDefaultSettingName()); sd.DisplayName.Localize(_stringLocalizerFactory).Value.ShouldNotBeNullOrWhiteSpace(); sd.Description.Localize(_stringLocalizerFactory).Value.ShouldNotBeNullOrWhiteSpace(); using (CultureHelper.Use("zh-Hans")) { sd.DisplayName.Localize(_stringLocalizerFactory).Value.ShouldNotBe(propName); sd.DisplayName.Localize(_stringLocalizerFactory).Value.ShouldNotBeNullOrWhiteSpace(); sd.Description.Localize(_stringLocalizerFactory).Value.ShouldNotBeNullOrWhiteSpace(); } using (CultureHelper.Use("zh-Hant")) { sd.DisplayName.Localize(_stringLocalizerFactory).Value.ShouldNotBe(propName); sd.DisplayName.Localize(_stringLocalizerFactory).Value.ShouldNotBeNullOrWhiteSpace(); sd.Description.Localize(_stringLocalizerFactory).Value.ShouldNotBeNullOrWhiteSpace(); } }
public void SettingDefinitionFirst() { _settingDefinitionManager.Get("Setting").ShouldBeOfType <SettingDefinition <string> >().Name.ShouldBe("Setting"); }