コード例 #1
0
 public void TearDown()
 {
     if (_cache != null)
     {
         _cache.Dispose();
     }
     _folder.Dispose();
 }
コード例 #2
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));
            }
        }