Пример #1
0
        public void EnsurePersistenceTest()
        {
            var numberOfSectorTesting = 5;

            _store.Initialize();
            // manually make a sector
            var sector = new Sector(_sectorSize);

            var contentBytes = new byte[sector.Contents.Length];

            for (var i = 0; i < numberOfSectorTesting; i++)
            {
                _rnd.NextBytes(contentBytes);
                contentBytes.AsSpan().CopyTo(sector.Contents);

                var index = _store.AllocateSectors(4);
                _store.Write(index, sector);
            }

            _store.EnsurePersistence();
            _store.Dispose();

            // reinit store
            _store = _storeFixiture.Create();

            _store.Initialize();
            var sectorIndex   = new SectorIndex((numberOfSectorTesting - 1) * 4);
            var storeProvided = _store.Read(sectorIndex);

            Assert.True(storeProvided.Contents.SequenceEqual(contentBytes.AsSpan()));
        }
Пример #2
0
 public void Close(ISectorStore store)
 {
     store.Dispose();
     File.Delete(TestStorePath);
     File.Delete(TestHotPath);
 }