public void given_versionOne_specific_settings_are_not_yet_saved_in_the_web_config()
        {
            before = () =>
            {
                _target   = new ProxySettingsProvider(null);
                _defaults = new DefaultProxySettingsProvider();
                new ConfigurationProvider().ClearAllSettings();
            };

            context["when i retrieve versionone specific settings"] = () =>
            {
                it["then the defaults are returned"] = () =>
                {
                    _target.ProxyIsEnabled.should_be(_defaults.ProxyIsEnabled);
                    _target.Uri.ToString().should_be(_defaults.Uri.ToString());
                    _target.Domain.should_be(_defaults.Domain);
                    _target.Username.should_be(_defaults.Username);
                    _target.Password.should_be(_defaults.Password);
                };
            };
        }
        public void given_versionOne_specific_settings_are_not_yet_saved_in_the_web_config()
        {
            before = () =>
            {
                _target = new ProxySettingsProvider(null);
                _defaults = new DefaultProxySettingsProvider();
                new ConfigurationProvider().ClearAllSettings();
            };

            context["when i retrieve versionone specific settings"] = () =>
            {
                it["then the defaults are returned"] = () =>
                {
                    _target.ProxyIsEnabled.should_be(_defaults.ProxyIsEnabled);
                    _target.Url.ToString().should_be(_defaults.Url.ToString());
                    _target.Domain.should_be(_defaults.Domain);
                    _target.Username.should_be(_defaults.Username);
                    _target.Password.should_be(_defaults.Password);
                };
            };
        }
        public void given_versionOne_specific_settings_are_saved_in_the_web_config()
        {
            const string proxyIsEnabled = "false";
            const string proxyDomain = "DOMAIN5000";
            const string proxyUrl = "http://myProxyUrl:9192/login/";
            const string proxyUserName = "******";
            const string proxyPassword = "******";

            before = () =>
                {

                    var settings = new Dictionary<string, string>()
                        {
                            {AppSettingKeys.ProxyIsEnabled, proxyIsEnabled},
                            {AppSettingKeys.ProxyDomain, proxyDomain},
                            {AppSettingKeys.ProxyUrl, proxyUrl},
                            {AppSettingKeys.ProxyUserName, proxyUserName},
                            {AppSettingKeys.ProxyPassword, proxyPassword}
                        };

                    _target = new ProxySettingsProvider(settings);
                    _defaults = new DefaultProxySettingsProvider();
                    new ConfigurationProvider().ClearAllSettings();

                    SettingsFileAdapter.SaveSettings(settings, Paths.ConfigurationDirectory, Paths.ConfigurationFileName);

                };

            context["when i retrieve versionone specific settings"] = () =>
                {
                    it["then the saved values are returned"] = () =>
                        {
                            _target.ProxyIsEnabled.should_be(bool.Parse(proxyIsEnabled));
                            _target.Domain.should_be(proxyDomain);
                            _target.Url.ToString().should_be(proxyUrl.ToLower()); //uri object stores url string in all lowercase
                            _target.Username.should_be(proxyUserName);
                            _target.Password.should_be(proxyPassword);
                        };
                };
        }
        public void given_versionOne_specific_settings_are_saved_in_the_web_config()
        {
            const string proxyIsEnabled = "false";
            const string proxyDomain    = "DOMAIN5000";
            const string proxyUrl       = "http://myProxyUrl:9192/login/";
            const string proxyUserName  = "******";
            const string proxyPassword  = "******";

            before = () =>
            {
                var settings = new Dictionary <string, string>()
                {
                    { AppSettingKeys.ProxyIsEnabled, proxyIsEnabled },
                    { AppSettingKeys.ProxyDomain, proxyDomain },
                    { AppSettingKeys.ProxyUrl, proxyUrl },
                    { AppSettingKeys.ProxyUserName, proxyUserName },
                    { AppSettingKeys.ProxyPassword, proxyPassword }
                };

                _target   = new ProxySettingsProvider(settings);
                _defaults = new DefaultProxySettingsProvider();
                new ConfigurationProvider().ClearAllSettings();

                SettingsFileAdapter.SaveSettings(settings, Paths.ConfigurationDirectory, Paths.ConfigurationFileName);
            };

            context["when i retrieve versionone specific settings"] = () =>
            {
                it["then the saved values are returned"] = () =>
                {
                    _target.ProxyIsEnabled.should_be(bool.Parse(proxyIsEnabled));
                    _target.Domain.should_be(proxyDomain);
                    _target.Uri.ToString().should_be(proxyUrl.ToLower());         //uri object stores url string in all lowercase
                    _target.Username.should_be(proxyUserName);
                    _target.Password.should_be(proxyPassword);
                };
            };
        }
Пример #5
0
 public ProxySettingsProvider(Dictionary<string, string> savedSettings)
 {
     _defaults = new DefaultProxySettingsProvider();
     _savedSettings = savedSettings;
 }
Пример #6
0
 public VersionOneSettings()
 {
     ProxySettings = new ProxyConnectionSettings();
 }
Пример #7
0
 public ProxySettingsProvider(Dictionary <string, string> savedSettings)
 {
     _defaults      = new DefaultProxySettingsProvider();
     _savedSettings = savedSettings;
 }