예제 #1
0
        public void Contents_Preserved_Through_Save_Load()
        {
            var chats = new ChatCollection((Data.GetChatCollectionA().Union(Data.GetChatCollectionB())));

            var db = new XmlChatDatabase("chats.xml");
            db.SaveChats(chats);

            var loaded = db.LoadChats();

            Assert.AreEqual(chats, loaded);
        }
예제 #2
0
        public void Speed_Test_Large_Save_Load()
        {
            var chats = Data.GetLargeChatCollection();
            var db = new XmlChatDatabase("large.xml");

            var stopwatch = new Stopwatch();
            stopwatch.Start();
            db.SaveChats(chats);
            stopwatch.Stop();

            var stopwatch2 = new Stopwatch();
            stopwatch2.Start();
            var loaded = db.LoadChats();
            stopwatch2.Stop();

            Assert.AreEqual(chats, loaded);
            Debug.WriteLine(string.Format("Saving took {0}; loading took {1}", stopwatch.Elapsed, stopwatch2.Elapsed));
        }