当前位置: 首页>>代码示例>>C#>>正文


C# IConfigurationProvider.ClearAllSettings方法代码示例

本文整理汇总了C#中IConfigurationProvider.ClearAllSettings方法的典型用法代码示例。如果您正苦于以下问题:C# IConfigurationProvider.ClearAllSettings方法的具体用法?C# IConfigurationProvider.ClearAllSettings怎么用?C# IConfigurationProvider.ClearAllSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IConfigurationProvider的用法示例。


在下文中一共展示了IConfigurationProvider.ClearAllSettings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: given_versionOne_specific_settings_are_not_yet_saved_in_the_file

        public void given_versionOne_specific_settings_are_not_yet_saved_in_the_file()
        {
            before = () =>
                {
                    _target = new ConfigurationProvider();
                    _defaults = new DefaultConfigurationProvider();
                    _target.ClearAllSettings();
                };

            context["when i retrieve versionone specific settings"] = () =>
                {
                    it["then the defaults are returned"] = () =>
                        {
                            _target = new ConfigurationProvider();
                            _target.VersionOneUserName.should_be(_defaults.VersionOneUserName);
                            _target.VersionOnePassword.should_be(_defaults.VersionOnePassword);
                            _target.VersionOneUrl.should_be(_defaults.VersionOneUrl);
                            _target.IsWindowsIntegratedSecurity.should_be(_defaults.IsWindowsIntegratedSecurity);
                            _target.TfsUrl.should_be(_defaults.TfsUrl);
                            _target.TfsListenerUrl.should_be(_defaults.TfsListenerUrl);
                            _target.TfsUserName.should_be(_defaults.TfsUserName);
                            _target.TfsPassword.should_be(_defaults.TfsPassword);
                            _target.ConfigurationUrl.should_be(_defaults.ConfigurationUrl);
                            _target.BaseListenerUrl.should_be(_defaults.BaseListenerUrl);
                        };
                };
        }
开发者ID:kunzimariano,项目名称:V1TFS,代码行数:27,代码来源:ConfigurationProviderSpecs.cs

示例2: given_versionOne_specific_settings_are_saved_in_the_file

        public void given_versionOne_specific_settings_are_saved_in_the_file()
        {
            const string userName = "User1";
            const string password = "[email protected]";
            const string v1Url = "https://www14.v1host.com/v1sdktesting/";
            const string tfsurl = "http://vsts2012:8080/tfs/DefaultCollection/";
            const string tfsListenerUrl = "http://localhost:5050/servicesRus.svc";
            const string tfsuser = "TfsUser1";
            const string tfspass = "MySecretPw";
            const string configUrl = "http://locahost:8181/";
            const string baseListenerUrl = "http://localhost:9090/";
            const bool useWindowsSecurity = false;

            before = () =>
                {
                    _target = new ConfigurationProvider();
                    _target.ClearAllSettings();

                    SettingsFileAdapter.SaveSettings(new Dictionary<string, string>()
                        {
                            {AppSettingKeys.VersionOneUserName, userName},
                            {AppSettingKeys.VersionOnePassword, password},
                            {AppSettingKeys.VersionOneUrl, v1Url},
                            {AppSettingKeys.IsWindowsIntegratedSecurity, useWindowsSecurity.ToString()},
                            {AppSettingKeys.TfsUrl, tfsurl.ToString()},
                            {AppSettingKeys.TfsListenerUrl, tfsListenerUrl.ToString()},
                            {AppSettingKeys.TfsUserName, tfsuser},
                            {AppSettingKeys.TfsPassword, tfspass},
                            {AppSettingKeys.ConfigurationUrl, configUrl},
                            {AppSettingKeys.BaseListenerUrl, baseListenerUrl}
                        }, Paths.ConfigurationDirectory, FileName);
                };

            context["when i retrieve versionone specific settings"] = () =>
                {
                    it["then the expected settings are returned"] = () =>
                        {
                            _target = new ConfigurationProvider();
                            _target.VersionOneUserName.should_be(userName);
                            _target.VersionOnePassword.should_be(password);
                            _target.VersionOneUrl.ToString().should_be(v1Url);
                            _target.IsWindowsIntegratedSecurity.should_be(useWindowsSecurity);
                            _target.TfsUrl.ToString().should_be(tfsurl);
                            _target.TfsListenerUrl.ToString().should_be(tfsListenerUrl);
                            _target.TfsUserName.should_be(tfsuser);
                            _target.TfsPassword.should_be(tfspass);
                            _target.ConfigurationUrl.ToString().should_be(configUrl);
                            _target.BaseListenerUrl.ToString().should_be(baseListenerUrl);
                        };
                };
        }
开发者ID:kunzimariano,项目名称:V1TFS,代码行数:51,代码来源:ConfigurationProviderSpecs.cs


注:本文中的IConfigurationProvider.ClearAllSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。