public void AppendBlobWorks(bool useFile) { IBlobManager blobManager = useFile ? new FileBlobManager() : new InMemoryBlobManager(); string path = GetPathForIndexAndBlobs(useFile); if (path == null) { return; } if (blobManager.Exists(path)) { blobManager.Delete(path); } blobManager.OpenForWriting(path); var data = new byte[] { 1, 2, 3, 4, 5, 6 }; blobManager.Append(path, data.Take(3).ToArray()); blobManager.Append(path, data.Skip(3).ToArray()); blobManager.CloseAfterWriting(path); long length = blobManager.GetLength(path); var result = blobManager.Read(path, 0, (int)length); result.ToArray().SequenceEqual(data).Should().BeTrue(); blobManager.Delete(path); data = new byte[] { 1, 2, 3, 4, 5, 6 }; blobManager.Append(path, data.Take(3).ToArray()); blobManager.Append(path, data.Skip(3).ToArray()); length = blobManager.GetLength(path); result = blobManager.Read(path, 0, (int)length); result.ToArray().SequenceEqual(data).Should().BeTrue(); }
} // this is ignored, because we just use the two specific types public void Append(string path, ReadOnlyMemory <byte> bytes) { Debug.WriteLine($"Appending to {path}: {String.Join(",", bytes.ToArray())}"); firstStorageType.Append(path, bytes); secondStorageType.Append(path, bytes); }