UnitTest1.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using REG_MARK_LIB;
  4. namespace UnitTestProject
  5. {
  6. [TestClass]
  7. public class UnitTest
  8. {
  9. [TestMethod]
  10. public void TestMethodCheckMarkIsTrue()
  11. {
  12. Assert.IsTrue(REG_MARK.CheckMark("a123aa456"), "true");
  13. }
  14. [TestMethod]
  15. public void TestMethodCheckMarkIsFalse()
  16. {
  17. Assert.IsFalse(REG_MARK.CheckMark("1234567"), "false");
  18. }
  19. [TestMethod]
  20. public void TestMethodCheckMarkIsInstanceOfType()
  21. {
  22. Assert.IsInstanceOfType(REG_MARK.CheckMark("1234567"), typeof(Boolean));
  23. }
  24. [TestMethod]
  25. public void TestMethodGetNextMarkAfterIsEquals()
  26. {
  27. Assert.AreEqual("a124aa456", REG_MARK.GetNextMarkAfter("a123aa456"));
  28. }
  29. [TestMethod]
  30. public void TestMethodGetNextMarkAfterIsInstanceOfType()
  31. {
  32. Assert.IsInstanceOfType(REG_MARK.GetNextMarkAfter("a123aa456"), typeof(String));
  33. }
  34. [TestMethod]
  35. public void TestMethodGetNextMarkAfterIsNotEquals()
  36. {
  37. Assert.AreNotEqual("112235687", REG_MARK.GetNextMarkAfter("a123aa456"));
  38. }
  39. [TestMethod]
  40. public void TestMethodGetNextMarkAfterInRangeAreNotEqual()
  41. {
  42. Assert.AreNotEqual("112235687", REG_MARK.GetNextMarkAfterInRange("a123aa456", "a120aa456", "a130aa456"));
  43. }
  44. [TestMethod]
  45. public void TestMethodGetNextMarkAfterInRangeAreEqual()
  46. {
  47. Assert.AreEqual("a124aa456", REG_MARK.GetNextMarkAfterInRange("a123aa456", "a120aa456", "a130aa456"));
  48. }
  49. [TestMethod]
  50. public void TestMethodGetNextMarkAfterInRangeIsInstanceOfType()
  51. {
  52. Assert.IsInstanceOfType(REG_MARK.GetNextMarkAfterInRange("a123aa456", "a120aa456", "a130aa456"), typeof(String));
  53. }
  54. [TestMethod]
  55. public void TestMethodGetCombinationsCountInRangeIsInstanceOfType()
  56. {
  57. Assert.IsInstanceOfType(REG_MARK.GetCombinationsCountInRange("a123aa456", "a130aa456"), typeof(int));
  58. }
  59. [TestMethod]
  60. public void TestMethodGetCombinationsCountInRangeAreEqual()
  61. {
  62. Assert.AreEqual(7, REG_MARK.GetCombinationsCountInRange("a123aa456", "a130aa456"));
  63. }
  64. [TestMethod]
  65. public void TestMethodGetNextMarkAfter1()
  66. {
  67. Assert.AreEqual("s", REG_MARK.GetNextMarkAfter("z999zz999"));
  68. }
  69. [TestMethod]
  70. public void TestMethodCheckMark2()
  71. {
  72. Assert.AreEqual(false, REG_MARK.CheckMark("1234567"));
  73. }
  74. [TestMethod]
  75. public void TestMethodGetNextMarkAfterInRange3()
  76. {
  77. Assert.AreEqual("s", REG_MARK.GetNextMarkAfterInRange("1234567", "1234567", "1234567"));
  78. }
  79. [TestMethod]
  80. public void TestMethodGetCombinationsCountInRange4()
  81. {
  82. Assert.AreEqual(0, REG_MARK.GetCombinationsCountInRange("z", "zds2"));
  83. }
  84. [TestMethod]
  85. public void TestMethodGetNextMarkAfterInRange5()
  86. {
  87. Assert.AreEqual("out of stock", REG_MARK.GetNextMarkAfterInRange("a123aa456", "a120aa456", "a110aa456"));
  88. }
  89. }
  90. }