Пример #1
0
        public void Should_Get_Default_Value()
        {
            var fakeSettingConfiguration = new Mock <ISettingConfiguration>();

            fakeSettingConfiguration.Setup(x => x.Providers).Returns(new TypeList <SettingProvider>());

            fakeSettingConfiguration.Object.Providers.Add <TestSettingProvider>();

            var fakeSettingDefinitionManager = new SettingDefinitonManager(fakeSettingConfiguration.Object);

            fakeSettingDefinitionManager.Initialize();

            var settingManager = new SettingManager(fakeSettingDefinitionManager);

            var value = settingManager.GetSettingValueAsync("EmailSettingNames.DefaultFromAddress", null, null);

            value.Result.ShouldBe("*****@*****.**");
        }
Пример #2
0
        public void Should_Change_Setting()
        {
            var fakeSettingConfiguration = new Mock <ISettingConfiguration>();

            fakeSettingConfiguration.Setup(x => x.Providers).Returns(new TypeList <SettingProvider>());

            fakeSettingConfiguration.Object.Providers.Add <TestSettingProvider>();

            var fakeSettingDefinitionManager = new SettingDefinitonManager(fakeSettingConfiguration.Object);

            fakeSettingDefinitionManager.Initialize();

            var settingManager = new SettingManager(fakeSettingDefinitionManager);

            settingManager.GetSettingValueAsync("EmailSettingNames.DefaultFromAddress", null, null);
            settingManager.ChangeSettingsAsync("EmailSettingNames.DefaultFromAddress", "*****@*****.**", null, null);

            var changedResult = settingManager.GetSettingValueAsync("EmailSettingNames.DefaultFromAddress", null, null);

            changedResult.Result.ShouldBe("*****@*****.**");
        }