public async Task DeleteComputeServerFormsCorrectUrlAndMethod() { var serverId = "1"; var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.DeleteServer(serverId); Assert.AreEqual(string.Format("{0}/servers/{1}", endpoint, serverId), this.simulator.Uri.ToString()); Assert.AreEqual(HttpMethod.Delete, this.simulator.Method); }
public async Task CanDeleteServer() { 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.DeleteServer(serverId); Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode); Assert.AreEqual(0, this.simulator.Servers.Count); }
public async Task DeleteComputeServerIncludesAuthHeader() { var client = new ComputeServiceRestClient(GetValidContext(), this.ServiceLocator); await client.DeleteServer("12345"); Assert.IsTrue(this.simulator.Headers.ContainsKey("X-Auth-Token")); Assert.AreEqual(this.authId, this.simulator.Headers["X-Auth-Token"]); }