Ejemplo n.º 1
0
        public void ShouldSaveProxySettingsToFile()
        {
            using (var savedData = new MemoryStream()) {
                var config = new FirefoxConfigReader();
                using (var reader = new StringReader(Properties.Resources.FFPrefsProxyDisabled)) {
                    config.LoadConfig(reader);
                }
                config.SetProxySettings(testProxy);

                using (var writer = new StreamWriter(savedData)) {
                    writer.AutoFlush = true;
                    config.SaveConfig(writer);

                    savedData.Flush();
                    savedData.Seek(0, SeekOrigin.Begin);
                    var rows = new HashSet <string>();
                    using (var reader = new StreamReader(savedData)) {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            rows.Add(line);
                        }
                    }
                    using (var reader = new StringReader(Properties.Resources.FFPrefs)) {
                        string line;
                        while ((line = reader.ReadLine()) != null)
                        {
                            Assert.AreEqual(true, rows.Contains(line));
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void ShouldSetProxySettings()
        {
            var config = new FirefoxConfigReader();

            config.SetProxySettings(testProxy);
            var tmp = config.ProxySettings();

            Assert.AreEqual(tmp, testProxy);
        }