コード例 #1
0
        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);
        }
コード例 #2
0
        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"}
                }
            };
            store.InsertAsync(simpleBlob).Wait();
            var metadata = store.GetMetadataAsync(simpleBlob.Id).Result;

            Assert.Equal("b", metadata["a"]);
            Assert.Equal("d", metadata["c"]);
        }
コード例 #3
0
        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" }
                }
            };

            store.InsertAsync(simpleBlob).Wait();
            var metadata = store.GetMetadataAsync(simpleBlob.Id).Result;

            Assert.Equal("b", metadata["a"]);
            Assert.Equal("d", metadata["c"]);
        }
コード例 #4
0
        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);
        }