UnitTest1.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using LibraryRDK;
  4. namespace UnitTest
  5. {
  6. [TestClass]
  7. public class UnitTest1
  8. {
  9. // тесты для функции PatternNumbers
  10. [TestMethod]
  11. public void TestMethodPatternNumbersAreEqual()
  12. {
  13. Assert.AreEqual(true, InputValidation.PatternNumbers("89999999999"));
  14. }
  15. [TestMethod]
  16. public void TestMethodPatternNumbersAreNotEqual()
  17. {
  18. Assert.AreNotEqual(false, InputValidation.PatternNumbers("89999999999"));
  19. }
  20. [TestMethod]
  21. public void TestMethodPatternNumbersIsTruel()
  22. {
  23. Assert.IsTrue(InputValidation.PatternNumbers("89999999999"));
  24. }
  25. [TestMethod]
  26. public void TestMethodPatternNumbersIsFalse()
  27. {
  28. Assert.IsFalse(InputValidation.PatternNumbers("привет"));
  29. }
  30. [TestMethod]
  31. public void TestMethodPatternNumbersIsInstanceOfType()
  32. {
  33. Assert.IsInstanceOfType(InputValidation.PatternNumbers("привет"), typeof(bool));
  34. }
  35. [TestMethod]
  36. public void TestMethodPatternNumbersIsNotInstanceOfType()
  37. {
  38. Assert.IsNotInstanceOfType(InputValidation.PatternNumbers("привет"), typeof(int));
  39. }
  40. [TestMethod]
  41. public void TestMethodPatternNumbersIsNotNull()
  42. {
  43. Assert.IsNotNull(InputValidation.PatternNumbers("привет"));
  44. }
  45. // тесты для функции Pattern
  46. [TestMethod]
  47. public void TestMethodPatternAreEqual()
  48. {
  49. Assert.AreEqual(true, InputValidation.Pattern("11:00-12:00"));
  50. }
  51. [TestMethod]
  52. public void TestMethodPatternAreNotEqual()
  53. {
  54. Assert.AreNotEqual(true, InputValidation.Pattern("привет"));
  55. }
  56. [TestMethod]
  57. public void TestMethodPatternIsTruel()
  58. {
  59. Assert.IsTrue(InputValidation.Pattern("11:00-12:00"));
  60. }
  61. [TestMethod]
  62. public void TestMethodPatternIsFalse()
  63. {
  64. Assert.IsFalse(InputValidation.Pattern("привет"));
  65. }
  66. [TestMethod]
  67. public void TestMethodPatternIsInstanceOfType()
  68. {
  69. Assert.IsInstanceOfType(InputValidation.Pattern("привет"), typeof(bool));
  70. }
  71. [TestMethod]
  72. public void TestMethodPatternIsNotInstanceOfType()
  73. {
  74. Assert.IsNotInstanceOfType(InputValidation.Pattern("привет"), typeof(int));
  75. }
  76. [TestMethod]
  77. public void TestMethodPatternIsNotNull()
  78. {
  79. Assert.IsNotNull(InputValidation.Pattern("привет"));
  80. }
  81. // тесты для функции CheckAuthorization
  82. [TestMethod]
  83. public void TestMethodCheckAuthorizationAreEqual()
  84. {
  85. Assert.AreEqual(true, InputValidation.CheckAuthorization("логин", "пароль"));
  86. }
  87. [TestMethod]
  88. public void TestMethodCheckAuthorizationAreNotEqual()
  89. {
  90. Assert.AreNotEqual(true, InputValidation.CheckAuthorization("", ""));
  91. }
  92. [TestMethod]
  93. public void TestMethodCheckAuthorizationIsTruel()
  94. {
  95. Assert.IsTrue(InputValidation.CheckAuthorization("логин", "пароль"));
  96. }
  97. [TestMethod]
  98. public void TestMethodCheckAuthorizationIsFalse()
  99. {
  100. Assert.IsFalse(InputValidation.CheckAuthorization("", ""));
  101. }
  102. [TestMethod]
  103. public void TestMethodCheckAuthorizationIsInstanceOfType()
  104. {
  105. Assert.IsInstanceOfType(InputValidation.CheckAuthorization("", ""), typeof(bool));
  106. }
  107. [TestMethod]
  108. public void TestMethodCheckAuthorizationIsNotInstanceOfType()
  109. {
  110. Assert.IsNotInstanceOfType(InputValidation.CheckAuthorization("", ""), typeof(int));
  111. }
  112. [TestMethod]
  113. public void TestMethodCheckAuthorizationIsNotNull()
  114. {
  115. Assert.IsNotNull(InputValidation.CheckAuthorization("", ""));
  116. }
  117. // тесты для функции CheckUsers
  118. [TestMethod]
  119. public void TestMethodCheckUsersAreEqual()
  120. {
  121. Assert.AreEqual(true, InputValidation.CheckUsers("имя", "фамилия", "отчество", "номер", 1, 1));
  122. }
  123. [TestMethod]
  124. public void TestMethodCheckUsersAreNotEqual()
  125. {
  126. Assert.AreNotEqual(true, InputValidation.CheckUsers("", "фамилия", "отчество", "номер", 1, 1));
  127. }
  128. [TestMethod]
  129. public void TestMethodCheckUsersIsTruel()
  130. {
  131. Assert.IsTrue(InputValidation.CheckUsers("имя", "фамилия", "отчество", "номер", 1, 1));
  132. }
  133. [TestMethod]
  134. public void TestMethodCheckUsersIsFalse()
  135. {
  136. Assert.IsFalse(InputValidation.CheckUsers("", "фамилия", "отчество", "номер", 1, 1));
  137. }
  138. [TestMethod]
  139. public void TestMethodCheckUsersIsInstanceOfType()
  140. {
  141. Assert.IsInstanceOfType(InputValidation.CheckUsers("", "фамилия", "отчество", "номер", 1, 1), typeof(bool));
  142. }
  143. [TestMethod]
  144. public void TestMethodCheckUsersIsNotInstanceOfType()
  145. {
  146. Assert.IsNotInstanceOfType(InputValidation.CheckUsers("", "фамилия", "отчество", "номер", 1, 1), typeof(int));
  147. }
  148. [TestMethod]
  149. public void TestMethodCheckUsersIsNotNull()
  150. {
  151. Assert.IsNotNull(InputValidation.CheckUsers("", "фамилия", "отчество", "номер", 1, 1));
  152. }
  153. }
  154. }