public void Should_handle_be_able_to_read_stored_values() { const string content = "Test"; var key = Put(content, TimeSpan.MaxValue); using (var stream = GridFsDataBus.Get(key)) { Assert.AreEqual(content, new StreamReader(stream).ReadToEnd()); } }
public async Task Should_handle_be_able_to_read_stored_values() { const string content = "Test"; var key = await Put(content, TimeSpan.MaxValue).ConfigureAwait(false); using (var stream = await GridFsDataBus.Get(key).ConfigureAwait(false)) { Assert.AreEqual(content, new StreamReader(stream).ReadToEnd()); } }
public async Task Should_handle_be_able_to_read_stored_values_concurrently() { const string content = "Test"; var key = await Put(content, TimeSpan.MaxValue).ConfigureAwait(false); var tasks = Enumerable.Range(0, 10).Select(i => { return(Task.Run(async() => { using (var stream = await GridFsDataBus.Get(key).ConfigureAwait(false)) { Assert.AreEqual(content, new StreamReader(stream).ReadToEnd()); } })); }); await Task.WhenAll(tasks).ConfigureAwait(false); }