Exemplo n.º 1
0
 public void ShouldSetHomePage()
 {
     using (var reader = new StringReader(Properties.Resources.FFPrefs)) {
         var config = new FirefoxConfigReader();
         config.LoadConfig(reader);
         config.SetHomePage(HomePage);
         Assert.AreEqual(HomePage, config.Homepage());
     }
 }
Exemplo n.º 2
0
        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());
                    }
                }
            }
        }