Example #1
0
        public void TagsAreNotReWrittenOnOpen()
        {
            var tags = new[]
            {
                "alpha", "beta", "charlie", "delta", "echo", "foxtrot", "golf"
            };

            foreach (var tag in tags)
            {
                _cache.AddOrGet(tag);
            }
            _cache.Dispose();
            _cache = null;

            using (var opened = new TagsCache())
            {
                opened.Open(_path);
                opened.Dispose();
            }

            using (var file = new RecordStream <int>())
            {
                file.Open(_path);
                file.DeclareRecordType(0, typeof(TagStorageClass));

                Assert.That(file.ReadRecords <TagStorageClass>().Count(t => t.Tag == "charlie"), Is.EqualTo(1));
            }
        }
Example #2
0
 private void LoadPaths()
 {
     foreach (var path in _file.ReadRecords <PathStorageClass>())
     {
         var id = GetNextPathId();
         _paths[path.Tags] = id;
         _pathLookup[id]   = path.Tags;
     }
 }
Example #3
0
 private void LoadTags()
 {
     foreach (var tag in _file.ReadRecords <TagStorageClass>())
     {
         var id = NextTagId();
         _tags[tag.Tag] = id;
         _strings[id]   = tag.Tag;
     }
 }