public void FileIndexIsRecoveredOnOpen() { var ids = Enumerable.Range(0, 20).Select(i => Guid.NewGuid()).ToList(); foreach (var guid in ids) { _cache.Add(new BinaryStorageClass { Id = guid }, _bytes); } _cache.Dispose(); _cache = new BinariesCache(_data); _cache.Open(_path); var newId = Guid.NewGuid(); _cache.Add(new BinaryStorageClass { Id = newId }, _bytes); Assert.That(_cache.Get(newId).FileIndex, Is.EqualTo(21)); }
public void NewBinaryCanBeAdded() { var id = _cache.Add(new BinaryStorageClass(), _bytes); Assert.That(id, Is.Not.EqualTo(Guid.Empty)); }