public async Task GetComputeServerMetadataFormsCorrectUrlAndMethod()
        {
            var serverId = "12345";
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.GetServerMetadata(serverId);

            Assert.AreEqual(string.Format("{0}/servers/{1}/metadata", endpoint, serverId), this.simulator.Uri.ToString());
            Assert.AreEqual(HttpMethod.Get, this.simulator.Method);
        }
        public async Task CanGetServerMetadata()
        {
            var metadata = new Dictionary<string, string>() { { "item1", "value1" }, { "item2", "value2" } };
            var serverId = "1";
            this.simulator.Servers.Add(new ComputeServer(serverId, "tiny",
                new Uri("http://testcomputeendpoint.com/v2/1234567890/servers/1"),
                new Uri("http://testcomputeendpoint.com/1234567890/servers/1"), metadata));

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

            var resp = await client.GetServerMetadata(serverId);

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

            var respContent = TestHelper.GetStringFromStream(resp.Content);
            Assert.IsTrue(respContent.Length > 0);

            var jObj = JObject.Parse(respContent);
            var metaToken = jObj["metadata"];
            Assert.IsNotNull(metaToken);

            var item1 = metaToken["item1"];
            Assert.IsNotNull(item1);
            Assert.AreEqual("value1", item1.Value<string>());

            var item2 = metaToken["item2"];
            Assert.IsNotNull(item2);
            Assert.AreEqual("value2", item2.Value<string>());
        }
        public async Task GetComputeServerMetadataIncludesAuthHeader()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.GetServerMetadata("12345");

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