[TestCase(new byte[] { 1, 2, 3 })]
[TestCase(new byte[] { 0, 0, 0, 24, 0, 0, 0, 0, 11, 22, 33 })] // fake header
[TestCase(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8})]
public void Cache_Can_Read_And_Write_Raw_Bytes(byte[] payload)
{
var cache = new FileCache(System.IO.Path.GetTempPath())
{
PayloadReadMode = FileCache.PayloadMode.RawBytes,
PayloadWriteMode = FileCache.PayloadMode.RawBytes
};
const string key = "key";
cache[key] = payload;
Assert.AreEqual(payload, cache[key]);
}
Reads NULL, throws EndOfStreamException or OutOfMemoryException. I wonder why reading raw bytes requires the magic header, which is never written and cannot find an unit test in the repository that reads/writes raw bytes and checks that the returned bytes equal the original bytes.