Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }