PrivateKeyFileTest.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using Renci.SshNet.Tests.Common;
  3. using System;
  4. using System.IO;
  5. using System.Reflection;
  6. using System.Text;
  7. namespace Renci.SshNet.Tests.Classes
  8. {
  9. /// <summary>
  10. /// old private key information/
  11. /// </summary>
  12. [TestClass]
  13. public class PrivateKeyFileTest : TestBase
  14. {
  15. [WorkItem(703), TestMethod]
  16. [ExpectedException(typeof(ArgumentNullException))]
  17. public void Test_PrivateKeyFile_EmptyFileName()
  18. {
  19. string fileName = string.Empty;
  20. var keyFile = new PrivateKeyFile(fileName);
  21. }
  22. [WorkItem(703), TestMethod]
  23. [ExpectedException(typeof(ArgumentNullException))]
  24. public void Test_PrivateKeyFile_StreamIsNull()
  25. {
  26. Stream stream = null;
  27. var keyFile = new PrivateKeyFile(stream);
  28. }
  29. [TestMethod]
  30. [Owner("olegkap")]
  31. [TestCategory("PrivateKey")]
  32. public void Test_PrivateKey_RSA()
  33. {
  34. new PrivateKeyFile(this.GetData("Key.RSA.txt"));
  35. }
  36. [TestMethod]
  37. [Owner("olegkap")]
  38. [TestCategory("PrivateKey")]
  39. public void Test_PrivateKey_RSA_DES_CBC()
  40. {
  41. new PrivateKeyFile(this.GetData("Key.RSA.Encrypted.Des.CBC.12345.txt"), "12345");
  42. }
  43. [TestMethod]
  44. [Owner("olegkap")]
  45. [TestCategory("PrivateKey")]
  46. public void Test_PrivateKey_RSA_DES_EDE3_CBC()
  47. {
  48. new PrivateKeyFile(this.GetData("Key.RSA.Encrypted.Des.Ede3.CBC.12345.txt"), "12345");
  49. }
  50. [TestMethod]
  51. [Owner("olegkap")]
  52. [TestCategory("PrivateKey")]
  53. public void Test_PrivateKey_RSA_AES_128_CBC()
  54. {
  55. new PrivateKeyFile(this.GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"), "12345");
  56. }
  57. [TestMethod]
  58. [Owner("olegkap")]
  59. [TestCategory("PrivateKey")]
  60. public void Test_PrivateKey_RSA_AES_192_CBC()
  61. {
  62. new PrivateKeyFile(this.GetData("Key.RSA.Encrypted.Aes.192.CBC.12345.txt"), "12345");
  63. }
  64. [TestMethod]
  65. [Owner("olegkap")]
  66. [TestCategory("PrivateKey")]
  67. public void Test_PrivateKey_RSA_AES_256_CBC()
  68. {
  69. new PrivateKeyFile(this.GetData("Key.RSA.Encrypted.Aes.256.CBC.12345.txt"), "12345");
  70. }
  71. [TestMethod]
  72. [Owner("olegkap")]
  73. [TestCategory("PrivateKey")]
  74. public void Test_PrivateKey_RSA_DES_EDE3_CFB()
  75. {
  76. new PrivateKeyFile(this.GetData("Key.RSA.Encrypted.Des.Ede3.CFB.1234567890.txt"), "1234567890");
  77. }
  78. /// <summary>
  79. ///A test for Dispose
  80. ///</summary>
  81. [TestMethod()]
  82. public void DisposeTest()
  83. {
  84. Stream privateKey = null; // TODO: Initialize to an appropriate value
  85. PrivateKeyFile target = new PrivateKeyFile(privateKey); // TODO: Initialize to an appropriate value
  86. target.Dispose();
  87. Assert.Inconclusive("A method that does not return a value cannot be verified.");
  88. }
  89. /// <summary>
  90. ///A test for PrivateKeyFile Constructor
  91. ///</summary>
  92. [TestMethod()]
  93. public void PrivateKeyFileConstructorTest()
  94. {
  95. Stream privateKey = null; // TODO: Initialize to an appropriate value
  96. string passPhrase = string.Empty; // TODO: Initialize to an appropriate value
  97. PrivateKeyFile target = new PrivateKeyFile(privateKey, passPhrase);
  98. Assert.Inconclusive("TODO: Implement code to verify target");
  99. }
  100. /// <summary>
  101. ///A test for PrivateKeyFile Constructor
  102. ///</summary>
  103. [TestMethod()]
  104. public void PrivateKeyFileConstructorTest1()
  105. {
  106. string fileName = string.Empty; // TODO: Initialize to an appropriate value
  107. string passPhrase = string.Empty; // TODO: Initialize to an appropriate value
  108. PrivateKeyFile target = new PrivateKeyFile(fileName, passPhrase);
  109. Assert.Inconclusive("TODO: Implement code to verify target");
  110. }
  111. /// <summary>
  112. ///A test for PrivateKeyFile Constructor
  113. ///</summary>
  114. [TestMethod()]
  115. public void PrivateKeyFileConstructorTest2()
  116. {
  117. string fileName = string.Empty; // TODO: Initialize to an appropriate value
  118. PrivateKeyFile target = new PrivateKeyFile(fileName);
  119. Assert.Inconclusive("TODO: Implement code to verify target");
  120. }
  121. /// <summary>
  122. ///A test for PrivateKeyFile Constructor
  123. ///</summary>
  124. [TestMethod()]
  125. public void PrivateKeyFileConstructorTest3()
  126. {
  127. Stream privateKey = null; // TODO: Initialize to an appropriate value
  128. PrivateKeyFile target = new PrivateKeyFile(privateKey);
  129. Assert.Inconclusive("TODO: Implement code to verify target");
  130. }
  131. }
  132. }