public void WhatIPutICanGet() { using (var fileCollection = new InMemoryFileCollection()) using (var cache = new DiskChunkCache(fileCollection, 20, 1000)) { cache.Put(CalcHash(new byte[] { 0 }), ByteBuffer.NewAsync(new byte[] { 1 })); Assert.Equal(new byte[] { 1 }, cache.Get(CalcHash(new byte[] { 0 })).Result.ToByteArray()); } }
public void ItRemebersContentAfterReopen() { using (var fileCollection = new InMemoryFileCollection()) { using (var cache = new DiskChunkCache(fileCollection, 20, 1000)) { cache.Put(CalcHash(new byte[] { 0 }), ByteBuffer.NewAsync(new byte[] { 1 })); } using (var cache = new DiskChunkCache(fileCollection, 20, 1000)) { Assert.Equal(new byte[] { 1 }, cache.Get(CalcHash(new byte[] { 0 })).Result.ToByteArray()); } } }