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)); } } } } }
public void ShouldSaveHomePage() { using (var savedData = new MemoryStream()) { var config = new FirefoxConfigReader(); using (var reader = new StringReader(Properties.Resources.FFPrefs)) { config.LoadConfig(reader); config.SetHomePage(HomePage); } using (var writer = new StreamWriter(savedData)) { writer.AutoFlush = true; config.SaveConfig(writer); savedData.Flush(); savedData.Seek(0, SeekOrigin.Begin); using (var reader = new StreamReader(savedData)) { var config2 = new FirefoxConfigReader(); config2.LoadConfig(reader); Assert.AreEqual(HomePage, config2.Homepage()); } } } }