public async Task CreateServerWithNullFlavorIdThrows()
 {
     var client = new ComputeServiceClient(GetValidCreds(), "Nova", CancellationToken.None, this.ServiceLocator);
     await client.CreateServer("MyServer", "12345", null, "54321", new List<string>() { "default" });
 }
 public async Task CreateServerWithEmptyNetworkIdThrows()
 {
     var client = new ComputeServiceClient(GetValidCreds(), "Nova", CancellationToken.None, this.ServiceLocator);
     await client.CreateServer("MyServer", "12345", "2", string.Empty, new List<string>() { "default" });
 }
        public async Task CanCreateServerWithoutKeyName()
        {
            var serverName = "MyServer";
            var imageId = "56789";
            var flavorId = "2";
            var networkId = "98765";
            var adminPassword = "******";
            var expServer = new ComputeServer("1235", serverName, adminPassword, new Uri("http://someuri.com/v2/servers/12345"),
                new Uri("http://someuri.com/servers/12345"), new Dictionary<string, string>());

            this.ServicePocoClient.CreateServerDelegate = (name, imgId, flvId, ntwId, key, groups) =>
            {
                Assert.AreEqual(serverName, name);
                Assert.AreEqual(imageId, imgId);
                Assert.AreEqual(flavorId, flvId);
                Assert.AreEqual(networkId, ntwId);
                Assert.AreEqual(string.Empty, key);
                Assert.IsTrue(groups.Any(g => g == "default"));
                return Task.Factory.StartNew(() => expServer);
            };

            var client = new ComputeServiceClient(GetValidCreds(), "Nova", CancellationToken.None, this.ServiceLocator);
            var server = await client.CreateServer(serverName, imageId, flavorId, networkId, new List<string>() { "default" });

            Assert.IsNotNull(server);
            Assert.AreEqual("1235", server.Id);
            Assert.AreEqual(adminPassword, server.AdminPassword);
        }