示例#1
0
        public async Task upload_object_with_metadata()
        {
            var fileName = Guid.NewGuid().ToString();

            using (var client = new RavenGoogleCloudClient(GoogleCloudFact.GoogleCloudSettings))
            {
                try
                {
                    await client.UploadObjectAsync(
                        fileName,
                        new MemoryStream(Encoding.UTF8.GetBytes("456")),
                        new Dictionary <string, string>
                    {
                        { "key1", "value1" },
                        { "key2", "value2" }
                    });

                    var obj = await client.GetObjectAsync(fileName);

                    Assert.Equal("value1", obj.Metadata["key1"]);
                    Assert.Equal("value2", obj.Metadata["key2"]);
                }

                finally
                {
                    await client.DeleteObjectAsync(fileName);
                }
            }
        }