public async Task CanUpdateImageMetadata()
        {
            var imageId = "12345";
            var created = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(10));
            var updated = DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(1));
            var metadata = new Dictionary<string, string>() { { "item1", "value1" }, { "item2", "value2" } };
            var image = new ComputeImage(imageId, "tiny",
                new Uri("http://testcomputeendpoint.com/v2/1234567890/images/12345"),
                new Uri("http://testcomputeendpoint.com/1234567890/images/12345"), new Dictionary<string, string>(),
                "ACTIVE", created, updated, 10, 512, 100);
            this.simulator.Images.Add(image);

            var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            var resp = await client.UpdateImageMetadata(imageId, metadata);

            Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode);

            Assert.AreEqual(2,image.Metadata.Count);
            Assert.AreEqual("value1",image.Metadata["item1"]);
            Assert.AreEqual("value2", image.Metadata["item2"]);
        }
        public async Task UpdateComputeImageMetadataFormsCorrectUrlAndMethod()
        {
            var metadata = new Dictionary<string, string>() { { "item1", "value1" }, { "item2", "value2" } };
            var imageId = "12345";
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.UpdateImageMetadata(imageId, metadata);

            Assert.AreEqual(string.Format("{0}/images/{1}/metadata", endpoint, imageId), this.simulator.Uri.ToString());
            Assert.AreEqual(HttpMethod.Post, this.simulator.Method);
        }
        public async Task UpdateComputeImageMetadataSetsCorrectContentType()
        {
            var metadata = new Dictionary<string, string>() { { "item1", "value1" }, { "item2", "value2" } };
            var imageId = "12345";
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.UpdateImageMetadata(imageId, metadata);

            Assert.AreEqual("application/json",this.simulator.ContentType);
        }
        public async Task UpdateComputeImageMetadataIncludesAuthHeader()
        {
            var metadata = new Dictionary<string, string>() { { "item1", "value1" }, { "item2", "value2" } };
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.UpdateImageMetadata("12345", metadata);

            Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token"));
            Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]);
        }