Beispiel #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));
            }
        }
Beispiel #2
0
        public void Open(string path)
        {
            _file = new RecordStream <int>();
            _file.Open(path);
            DeclareRecordType();

            LoadTags();
        }
Beispiel #3
0
        public void Open(string path)
        {
            lock (_lock)
            {
                _file = new RecordStream <int>();
                DeclareRecordType();
                _file.Open(path);

                LoadPaths();
            }
        }