public async Task AssignFloatingIpFormsCorrectBody()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            var serverId = "12345";
            var ipAddress = "172.0.0.1";

            await client.AssignFloatingIp(serverId, ipAddress);

            this.simulator.Content.Position = 0;
            var reqContent = TestHelper.GetStringFromStream(this.simulator.Content);

            var body = JObject.Parse(reqContent);
            Assert.IsNotNull(body["addFloatingIp"]);
            Assert.IsNotNull(body["addFloatingIp"]["address"]);
            Assert.AreEqual(ipAddress, (string)body["addFloatingIp"]["address"]);
        }
        public async Task CanAssignFloatingIp()
        {
            var serverId = "12345";
            var server = new ComputeServer(serverId, "tiny",
                new Uri("http://testcomputeendpoint.com/v2/1234567890/servers/1"),
                new Uri("http://testcomputeendpoint.com/1234567890/servers/1"), new Dictionary<string, string>());
            this.simulator.Servers.Add(server);
            var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            var resp = await client.AssignFloatingIp(serverId, "172.0.0.1");

            Assert.AreEqual(HttpStatusCode.Accepted, resp.StatusCode);
        }
        public async Task AssignFloatingIpIncludesContentTypeHeader()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.AssignFloatingIp("12345", "172.0.0.1");

            Assert.IsTrue(this.simulator.ContentType != string.Empty);
            Assert.AreEqual("application/json", this.simulator.ContentType);
        }
        public async Task AssignFloatingIpFormsCorrectUrlAndMethod()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);
            var serverId = "12345";
            await client.AssignFloatingIp(serverId, "172.0.0.1");

            Assert.AreEqual(string.Format("{0}/servers/{1}/action", endpoint, serverId), this.simulator.Uri.ToString());
            Assert.AreEqual(HttpMethod.Post, this.simulator.Method);
        }
        public async Task AssignFloatingIpIncludesAuthHeader()
        {
            var client =
                new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator);

            await client.AssignFloatingIp("12345", "172.0.0.1");

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