UnitTest1.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. namespace UnitTests
  2. {
  3. /// <summary>
  4. /// Êëàññ òåñòîâ íèçêîé ñëîæíîñòè
  5. /// </summary>
  6. public class LowDifficult
  7. {
  8. /// <summary>
  9. /// Òåñò ôóíêöèè CheckMark, ñ ïðàâèëüíûì íîìåðîì
  10. /// </summary>
  11. [Fact]
  12. public void TestCheckMarkWithCorrectData()
  13. {
  14. Assert.True(REG_MARK_LIB.REG_MARK_LIB.CheckMark("a999aa99"));
  15. }
  16. /// <summary>
  17. /// Òåñò ôóíêöèè CheckMark, ñ íåïðàâèëüíûì íîìåðîì
  18. /// </summary>
  19. [Fact]
  20. public void TestCheckMarkWithIncorrectData()
  21. {
  22. Assert.False(REG_MARK_LIB.REG_MARK_LIB.CheckMark("a999aa999"));
  23. }
  24. /// <summary>
  25. /// Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå ÷èñëà â ñîñòàâå íîìåðà
  26. /// </summary>
  27. [Fact]
  28. public void TestGetNextMarkAfterWithCorrectDataOnSecondNumber()
  29. {
  30. Assert.Equal("T357OK52", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("T356OK52"));
  31. }
  32. /// <summary>
  33. /// Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå ïåðâîé áóêâû â ñîñòàâå íîìåðà
  34. /// </summary>
  35. [Fact]
  36. public void TestGetNextMarkAfterWithCorrectDataOnFirstLetter()
  37. {
  38. Assert.Equal("Y001OK52", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("T999OK52"));
  39. }
  40. /// <summary>
  41. /// Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå òðåòåé áóêâû â ñîñòàâå íîìåðà
  42. /// </summary>
  43. [Fact]
  44. public void TestGetNextMarkAfterWithCorrectDataOnThirdLetter()
  45. {
  46. Assert.Equal("A001OM52", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("X999OK52"));
  47. }
  48. /// <summary>
  49. /// Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå âòîðîé áóêâû â ñîñòàâå íîìåðà
  50. /// </summary>
  51. [Fact]
  52. public void TestGetNextMarkAfterWithCorrectDataOnSecondLetter()
  53. {
  54. Assert.Equal("A001PA52", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("X999OX52"));
  55. }
  56. /// <summary>
  57. /// Òåñò ôóíêöèè GetNextMarkAfterInRange, ñ êîððåêòíûìè äàííûìè
  58. /// </summary>
  59. [Fact]
  60. public void TestGetNextMarkAfterInRangeWithCorrectData()
  61. {
  62. Assert.Equal("A001PA52", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("X999OX52", "A001AA52", "X999XX52"));
  63. }
  64. /// <summary>
  65. /// Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè èçíà÷àëüíîì íîìåðå íå âõîäÿùåì â äèàïàçîí (ìåíüøå)
  66. /// </summary>
  67. [Fact]
  68. public void TestGetNextMarkAfterInRangeWithIncorrectDataSmallerThanStart()
  69. {
  70. Assert.Equal("out of stock", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("A001AA52", "X999OX52", "X999XX52"));
  71. }
  72. /// <summary>
  73. /// Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè èçíà÷àëüíîì íîìåðå íå âõîäÿùåì â äèàïàçîí (áîëüøå)
  74. /// </summary>
  75. [Fact]
  76. public void TestGetNextMarkAfterInRangeWithIncorrectDataBiggerThanEnd()
  77. {
  78. Assert.Equal("out of stock", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("X999YX52", "A001AA52", "X999OX52"));
  79. }
  80. /// <summary>
  81. /// Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè íåêîððåêòíîì äèàïàçîíå
  82. /// </summary>
  83. [Fact]
  84. public void TestGetNextMarkAfterInRangeWithIncorrectDataIncorrectBounds()
  85. {
  86. Assert.Equal("out of stock", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("X999YX52", "X999OX52", "A001AA52"));
  87. }
  88. /// <summary>
  89. /// Òåñò ôóíêöèè GetCombinationsCountInRange, ñ îáû÷íûìè äàííûìè
  90. /// </summary>
  91. [Fact]
  92. public void TestGetCombinationsCountInRangeWithCorrectData()
  93. {
  94. Assert.Equal(2, REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("T356OK52", "T357OK52"));
  95. }
  96. /// <summary>
  97. /// Òåñò ôóíêöèè GetCombinationsCountInRange, ñ ïåðåâåðíóòûìè ãðàíèöàìè
  98. /// </summary>
  99. [Fact]
  100. public void TestGetCombinationsCountInRangeWithCorrectDataReverse()
  101. {
  102. Assert.Equal(2, REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("T357OK52", "T356OK52"));
  103. }
  104. /// <summary>
  105. /// Òåñò ôóíêöèè GetCombinationsCountInRange, ñ îäèíàêîâûìè ãðàíèöàìè
  106. /// </summary>
  107. [Fact]
  108. public void TestGetCombinationsCountInRangeWithCorrectDataEqualsBounds()
  109. {
  110. Assert.Equal(1, REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("T356OK52", "T356OK52"));
  111. }
  112. }
  113. /// <summary>
  114. /// Êëàññ òåñòîâ âûñîêîé ñëîæíîñòè
  115. /// </summary>
  116. public class HighDifficult
  117. {
  118. /// <summary>
  119. /// Òåñò ôóíêöèè CheckMark, ïðè ïåðåäà÷å null
  120. /// </summary>
  121. [Fact]
  122. public void TestCheckMarkOnNull()
  123. {
  124. Assert.Throws<ArgumentNullException>(() => REG_MARK_LIB.REG_MARK_LIB.CheckMark(null));
  125. }
  126. /// <summary>
  127. /// Òåñò ôóíêöèè GetNextMarkAfter, ïðè ïåðåäà÷å íå íîìåðà
  128. /// </summary>
  129. [Fact]
  130. public void TestGetNextMarkAfterOnNotMark()
  131. {
  132. Assert.Throws<ArgumentException>(() => REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("Hello world!"));
  133. }
  134. /// <summary>
  135. /// Òåñò ôóíêöèè GetNextMarkAfter, ïðè ïåðåäà÷å íîìåðà, äëÿ êîòîðîãî íåò ñëåäóþùåãî íîìåðà
  136. /// </summary>
  137. [Fact]
  138. public void TestGetNextMarkAfterOnNotNextMark()
  139. {
  140. Assert.Throws<Exception>(() => REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("x999xx52"));
  141. }
  142. /// <summary>
  143. /// Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè ïåðåäà÷å íå íîìåðà
  144. /// </summary>
  145. [Fact]
  146. public void TestGetNextMarkAfterInRangeOnNotMark()
  147. {
  148. Assert.Throws<ArgumentException>(() => REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("Hello world!", "a999aa52", "a999aa52"));
  149. }
  150. /// <summary>
  151. /// Òåñò ôóíêöèè GetCombinationsCountInRange, ïðè ïåðåäà÷å íå íîìåðà
  152. /// </summary>
  153. [Fact]
  154. public void TestGetCombinationsCountInRangeOnNotMark()
  155. {
  156. Assert.Throws<ArgumentException>(() => REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("Hello world!", "a999aa52"));
  157. }
  158. }
  159. }