public void GetKeypairTest()
        {
            var    os          = new OpenStackMember(UserName, Password, TenantName, TenantId);
            string keypairName = string.Format("keypair-key-{0}", TesterName);

            KeypairData[] keypairs = os.ListKeypairs().ToArray <KeypairData>();
            string        name     = (from b in keypairs where b.KeyPair.Name == keypairName select b.KeyPair.Name).FirstOrDefault();

            if (string.IsNullOrEmpty(name))
            {
                // add keypair
                Keypair kp = os.AddKeypair(keypairName);
                Assert.IsNotNull(kp);
                Assert.IsNotNull(kp.PublicKey);
                Assert.IsNotNull(kp.FingerPrint);
                Assert.IsNotNull(kp.UserId);
                Trace.WriteLine(String.Format("keypair added : {0}", DateTime.Now));
                Trace.WriteLine(String.Format("KeypairName : {0}", kp.Name));
            }

            Keypair k = os.GetKeypair(keypairName);

            Assert.IsNotNull(k);
            Assert.IsNotNull(k.Name);
            Trace.WriteLine(k.Name);
            Assert.IsNotNull(k.PublicKey);
            Trace.WriteLine(k.PublicKey);
        }
        public void AddKeypairTest()
        {
            var os = new OpenStackMember(UserName, Password, TenantName, TenantId);
            // decide keypair name which is not duplicated.
            IEnumerable <KeypairData> keypairs = os.ListKeypairs();
            IEnumerable <string>      names    = keypairs.GroupBy(s => s.KeyPair.Name, (key, g) => key);

            string[] data        = Enumerable.Range(1, 100).Select(i => string.Format("keypair-key-{0}_{1}", TesterName, i)).ToArray <string>();
            string   keypairName = (from b in data where !names.Contains <string>(b) select b).First();

            Keypair kp = os.AddKeypair(keypairName);

            Assert.IsNotNull(kp);
            Assert.IsNotNull(kp.PublicKey);
            Assert.IsNotNull(kp.FingerPrint);
            Assert.IsNotNull(kp.UserId);
            Trace.WriteLine(String.Format("keypair added : {0}", DateTime.Now));
            Trace.WriteLine(String.Format("KeypairName : {0}", kp.Name));

            // delete keypair
            Assert.IsTrue(os.DeleteKeypair(keypairName));
            Trace.WriteLine(String.Format("keypair deleted : {0}", DateTime.Now));
        }