public async Task CanInsertAndGetBackMetadat() { var store = new AzureKeyValueStore(ConnectionString, ContainerName); var simpleBlob = new SimpleBlob() { Body = new MemoryStream(new byte[4096]), Id = Guid.NewGuid().ToString("N"), Metadata = new Dictionary <string, string>() { { "a", "b" }, { "c", "d" }, { "Content-Type", "image/png" } } }; await store.InsertAsync(simpleBlob); var metadata = await store.GetMetadataAsync(simpleBlob.Id); var blob2 = await store.GetAsync(simpleBlob.Id); var blockBlob = (CloudBlockBlob)blob2.UnderlyingBlob; Assert.Equal("b", metadata["a"]); Assert.Equal("d", metadata["c"]); Assert.Equal("image/png", blockBlob.Properties.ContentType); }
public void ReadLargeFile(string fileName) { var store = new AzureKeyValueStore(_cn, ContainerName); var blob = store.GetAsync(fileName).Result; var stream = new MemoryStream(); blob.Body.CopyTo(stream); Assert.Equal( ((CloudBlockBlob)blob.UnderlyingBlob).Properties.Length, stream.Length); }
public void ReadLargeFile(string fileName) { var store = new AzureKeyValueStore(_cn, ContainerName); var blob = store.GetAsync(fileName).Result; var stream = new MemoryStream(); blob.Body.CopyTo(stream); Assert.Equal(((CloudBlockBlob)blob.UnderlyingBlob).Properties.Length, stream.Length); }
public void CanInsertAndGetBackMetadat() { var store = new AzureKeyValueStore(ConnectionString, ContainerName); var simpleBlob = new SimpleBlob() { Body = new MemoryStream(new byte[4096]), Id = Guid.NewGuid().ToString("N"), Metadata = new Dictionary<string, string>() { {"a", "b"}, {"c", "d"}, {"Content-Type", "image/png"} } }; store.InsertAsync(simpleBlob).Wait(); var metadata = store.GetMetadataAsync(simpleBlob.Id).Result; var blob2 = store.GetAsync(simpleBlob.Id).Result; var blockBlob = (CloudBlockBlob) blob2.UnderlyingBlob; Assert.Equal("b", metadata["a"]); Assert.Equal("d", metadata["c"]); Assert.Equal("image/png", blockBlob.Properties.ContentType); }