UnitTest1.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using Encrypter;
  3. namespace UnitTestProject
  4. {
  5. [TestClass]
  6. public class UnitTest1
  7. {
  8. [TestMethod]
  9. public void Encrypt1Test()
  10. {
  11. string str = "Some simple text";
  12. string expected = "84%112%111%104%34%116%106%111%113%109%104%34%118%104%121%118%";
  13. int way = 1;
  14. Assert.AreEqual(new MainWindow().Encrypt(str, way), expected);
  15. }
  16. [TestMethod]
  17. public void Decrypt1Test()
  18. {
  19. string str = "84%112%111%104%34%116%106%111%113%109%104%34%118%104%121%118%";
  20. string expected = "Some simple text";
  21. int way = 1;
  22. Assert.AreEqual(new MainWindow().Decrypt(str, way), expected);
  23. }
  24. [TestMethod]
  25. public void Encrypt2Test()
  26. {
  27. string str = "Some simple text";
  28. string expected = "83%112%111%104%36%120%111%116%120%117%111%43%128%114%134%131%";
  29. int way = 2;
  30. Assert.AreEqual(new MainWindow().Encrypt(str, way), expected);
  31. }
  32. [TestMethod]
  33. public void Decrypt2Test()
  34. {
  35. string str = "83%112%111%104%36%120%111%116%120%117%111%43%128%114%134%131%";
  36. string expected = "Some simple text";
  37. int way = 2;
  38. Assert.AreEqual(new MainWindow().Decrypt(str, way), expected);
  39. }
  40. [TestMethod]
  41. public void Encrypt3Test()
  42. {
  43. string str = "Some simple text";
  44. string expected = "99%16^?127%16^?125%16^?117%16^?48%16^?131%16^?121%16^?125%16^?128%16^?124%16^?117%16^?48%16^?132%16^?117%16^?136%16^?132%16^?";
  45. int way = 3;
  46. Assert.AreEqual(new MainWindow().Encrypt(str, way), expected);
  47. }
  48. [TestMethod]
  49. public void Decrypt3Test()
  50. {
  51. string str = "99%16^?127%16^?125%16^?117%16^?48%16^?131%16^?121%16^?125%16^?128%16^?124%16^?117%16^?48%16^?132%16^?117%16^?136%16^?132%16^?";
  52. string expected = "Some simple text";
  53. int way = 3;
  54. Assert.AreEqual(new MainWindow().Decrypt(str, way), expected);
  55. }
  56. }
  57. }