コード例 #1
0
        public void TestFastLoadWorksCorrectly()
        {
            Directory.CreateDirectory(path);

            var store = new FileBasedDictionary <Dog>(path, false);

            Guid id  = Guid.NewGuid();
            Dog  dog = new Dog();

            dog.Age   = 20;
            store[id] = dog;

            // as a side effect we will have the fastload file
            store.Validate();

            dog.Age   = 21;
            store[id] = dog;


            var store2 = new FileBasedDictionary <Dog>(path, false);

            store2.LoadFastLoadData();
            store2.Validate();

            Assert.AreEqual(21, store2[id].Age);

            store.Dispose();
            store2.Dispose();

            Directory.Delete(path, true);
        }
コード例 #2
0
        public void TestFastLoadWorksCorrectly()
        {
            Directory.CreateDirectory(path);

            var store = new FileBasedDictionary<Dog>(path,false);

            Guid id = Guid.NewGuid();
            Dog dog = new Dog();
            dog.Age = 20;
            store[id] = dog;

            // as a side effect we will have the fastload file
            store.Validate();

            dog.Age = 21;
            store[id] = dog;

            var store2 = new FileBasedDictionary<Dog>(path, false);
            store2.LoadFastLoadData();
            store2.Validate();

            Assert.AreEqual(21, store2[id].Age);

            store.Dispose();
            store2.Dispose();

            Directory.Delete(path, true);
        }