コード例 #1
0
        public void SaveAndLoad()
        {
            history.AddActivity("saved");
            history.AddActivity("saved2");
            StringBuilder sb     = new StringBuilder();
            StringWriter  writer = new StringWriter(sb);

            history.Save(writer);
            history = new ActivitiesHistory();
            history.Load(new StringReader(sb.ToString()));
            Assert.AreEqual(new string[] { "saved2", "saved" }, history.Activities);
        }
コード例 #2
0
 public void SaveAndLoad()
 {
     history.AddActivity("saved");
     history.AddActivity("saved2");
     StringBuilder sb = new StringBuilder();
     StringWriter writer = new StringWriter(sb);
     history.Save(writer);
     history = new ActivitiesHistory();
     history.Load(new StringReader(sb.ToString()));
     Assert.AreEqual(new string[] { "saved2", "saved" }, history.Activities);
 }
コード例 #3
0
 public void Load()
 {
     File.CreateText("HistoryTest-Load.txt").Close();
     Assert.IsTrue(history.Load("HistoryTest-Load.txt"));
 }