UnitTest1.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using VINLIB;
  2. namespace VINTEST
  3. {
  4. [TestClass]
  5. public class UnitTest
  6. {
  7. VINLIB.Class1 class1 = new VINLIB.Class1();
  8. [TestMethod]
  9. public void LenghtVin()
  10. {
  11. int except = 17;
  12. int actual = class1.vin.Length;
  13. Assert.AreEqual(except, actual);
  14. }
  15. [TestMethod]
  16. public void ExceptionsVin()
  17. {
  18. class1.VIN();
  19. bool except = class1.vin.Contains('O');
  20. except = class1.vin.Contains('Q');
  21. except = class1.vin.Contains('I');
  22. Assert.IsFalse(except);
  23. }
  24. [TestMethod]
  25. public void Country()
  26. {
  27. class1.WMI();
  28. bool except = true;
  29. if (class1.vin[0] == '0')
  30. {
  31. except = false;
  32. }
  33. Assert.IsTrue(except);
  34. }
  35. [TestMethod]
  36. public void TheLust4()
  37. {
  38. class1.VIS();
  39. bool except = false;
  40. for (int i = 13; i < 16; i++)
  41. {
  42. if (class1.vin[i] >= '0' && class1.vin[i] <= '9')
  43. {
  44. except = true;
  45. }
  46. }
  47. Assert.IsTrue(except);
  48. }
  49. [TestMethod]
  50. public void VIN9_1()
  51. {
  52. string str = "JHMCM56557C404453";
  53. class1.vin = str.ToCharArray();
  54. class1.CHK();
  55. int except = 368;
  56. int actual = class1.a;
  57. Assert.AreEqual(except, actual);
  58. }
  59. [TestMethod]
  60. public void VIN9_2()
  61. {
  62. string str = "JHMCM56557C404453";
  63. class1.vin = str.ToCharArray();
  64. class1.CHK();
  65. int except = 363;
  66. int actual = class1.c;
  67. Assert.AreEqual(except, actual);
  68. }
  69. [TestMethod]
  70. public void VIN9_3()
  71. {
  72. string str = "JHMCM56557C404453";
  73. class1.vin = str.ToCharArray();
  74. class1.CHK();
  75. int except = 5;
  76. int actual = class1.d;
  77. Assert.AreEqual(except, actual);
  78. }
  79. [TestMethod]
  80. public void VIN9__10()
  81. {
  82. string str = "JHMDM56557C404453";
  83. class1.vin = str.ToCharArray();
  84. class1.CHK();
  85. char except = 'X';
  86. char actual = class1.vin[8];
  87. Assert.AreEqual(except, actual);
  88. }
  89. [TestMethod]
  90. public void VIN9__A()
  91. {
  92. bool except = false;
  93. string str = "JHMDM565H7C404453";
  94. class1.vin = str.ToCharArray();
  95. if (class1.vin[8] >= '0' && class1.vin[8] <= '9' || class1.vin[8] == 'X')
  96. {
  97. except = true;
  98. }
  99. Assert.IsFalse(except);
  100. }
  101. }
  102. }