UnitTest1.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using Session2;
  4. namespace UnitTestSession2
  5. {
  6. [TestClass]
  7. public class UnitTest1
  8. {
  9. //Низкая сложность
  10. [TestMethod]
  11. public void TestAreEqualCheckMarkTrue()
  12. {
  13. Assert.AreEqual(REG_MARK_LIB.CheckMark("C065MK078"), true);
  14. }
  15. [TestMethod]
  16. public void TestAreEqualCheckMarkFalse()
  17. {
  18. Assert.AreEqual(REG_MARK_LIB.CheckMark("I714OP900"), false);
  19. }
  20. [TestMethod]
  21. public void TestAreEqualGetNextMarkAfter()
  22. {
  23. Assert.AreEqual(REG_MARK_LIB.GetNextMarkAfter("C065MK078"), "A66AA78");
  24. }
  25. [TestMethod]
  26. public void TestAreNotEqualGetNextMarkAfter()
  27. {
  28. Assert.AreNotEqual(REG_MARK_LIB.GetNextMarkAfter("C065MK078"), "A66AA078");
  29. }
  30. [TestMethod]
  31. public void TestIsTrueCheckMark()
  32. {
  33. Assert.IsTrue(REG_MARK_LIB.CheckMark("A000AA000"));
  34. }
  35. [TestMethod]
  36. public void TestIsFalseCheckMark()
  37. {
  38. Assert.IsFalse(REG_MARK_LIB.CheckMark("0000AA000"));
  39. }
  40. [TestMethod]
  41. public void TestIsInstanceOfTypeGetNextMarkAfterInRange()
  42. {
  43. Assert.IsInstanceOfType(REG_MARK_LIB.GetNextMarkAfterInRange("C148FY121", "C010HH00", "H091HY129"), typeof(string));
  44. }
  45. [TestMethod]
  46. public void TestAreNotEqualGetCombinationsCountInRange()
  47. {
  48. Assert.AreNotEqual(REG_MARK_LIB.GetCombinationsCountInRange("C065MK078", "C065MK097"), "19");
  49. }
  50. [TestMethod]
  51. public void TestIsNotInstanceOfTypeGetCombinationsCountInRange()
  52. {
  53. Assert.IsNotInstanceOfType(REG_MARK_LIB.GetCombinationsCountInRange("C065MK078", "C065MK097"), typeof(bool));
  54. }
  55. [TestMethod]
  56. public void TestReferenceEqualsCheckMark()
  57. {
  58. Assert.ReferenceEquals(REG_MARK_LIB.CheckMark("A00AA000"), REG_MARK_LIB.CheckMark("A111AA111"));
  59. }
  60. //Высокая сложность
  61. [TestMethod]
  62. public void TestThrowsExceptionGetNextMarkAfter1()
  63. {
  64. Assert.ThrowsException<System.Exception>(() => REG_MARK_LIB.GetNextMarkAfter("dd17dd"));
  65. }
  66. [TestMethod]
  67. public void TestThrowsExceptionGetNextMarkAfter2()
  68. {
  69. Assert.ThrowsException<System.Exception>(() => REG_MARK_LIB.GetNextMarkAfter("йцу12"));
  70. }
  71. [TestMethod]
  72. public void TestThrowsExceptionGetNextMarkAfterInRange()
  73. {
  74. Assert.ThrowsException<System.Exception>(() => REG_MARK_LIB.GetNextMarkAfterInRange("PL43L32", "G143", "tr321hy092"));
  75. }
  76. [TestMethod]
  77. public void TestThrowsExceptionGetCombinationsCountInRange1()
  78. {
  79. Assert.ThrowsException<System.Exception>(() => REG_MARK_LIB.GetCombinationsCountInRange("0F3S3", "54gww21"));
  80. }
  81. [TestMethod]
  82. public void TestThrowsExceptionGetCombinationsCountInRange2()
  83. {
  84. Assert.ThrowsException<System.Exception>(() => REG_MARK_LIB.GetCombinationsCountInRange("G-1Kf", ""));
  85. }
  86. }
  87. }