public async Task ReadAllTextAsync() { var blobId = await PutTestBlob("a.txt", Encoding.UTF8.GetBytes("some text in a.txt")); var blobInfo = new BlobInfo(blobId, "a.txt"); var stm = new DummyStateMachine(); stm.Store = _store; var result = await blobInfo.ReadAllTextAsync(stm); Assert.Equal("some text in a.txt", result); }
public async Task ReadAsJsonAsync() { var blobId = await PutTestBlob("a.txt", Encoding.UTF8.GetBytes("{ \"Name\": \"ActorInBlob\", \"Stage\": \"Start\" }")); var blobInfo = new BlobInfo(blobId, "a.txt"); var stm = new DummyStateMachine(); stm.Store = _store; var result = await blobInfo.ReadAsJsonAsync <ActorInfo>(stm); Assert.Equal("ActorInBlob", result.Name); Assert.Equal("Start", result.Stage); }
public async Task ReadAllBytesAsync() { var blobId = await PutTestBlob("a.txt", new byte[] { 1, 2, 3 }); var blobInfo = new BlobInfo(blobId, "a.txt"); var stm = new DummyStateMachine(); stm.Store = _store; var result = await blobInfo.ReadAllBytesAsync(stm); Assert.Equal( JsonConvert.SerializeObject(new byte[] { 1, 2, 3 }), JsonConvert.SerializeObject(result)); }