UnitTest1.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using DllforTesting;
  2. namespace UnitTestForDLL
  3. {
  4. public class UnitTest1
  5. {
  6. #region Íèçêîé ñëîæíîñòè
  7. [Fact]
  8. public void CheckMarkOnTrue()
  9. {
  10. Assert.True(Class1.CheckMark("A123CA777"));
  11. }
  12. [Fact]
  13. public void CheckMarkOnFalse()
  14. {
  15. Assert.False(Class1.CheckMark("A123CA808"));
  16. }
  17. [Fact]
  18. public void CheckMarkOnNull()
  19. {
  20. Assert.NotNull(Class1.CheckMark("A123CA731"));
  21. }
  22. [Fact]
  23. public void CheckRegionsCollection()
  24. {
  25. Assert.NotEmpty(Class1.regions);
  26. }
  27. [Fact]
  28. public void CheckNextMark()
  29. {
  30. Assert.IsType<string>(Class1.GetNextMarkAfter("B456BX052"));
  31. }
  32. [Fact]
  33. public void CheckNextMarkInRange()
  34. {
  35. Assert.IsType<string>(Class1.GetNextMarkAfterInRange("B456BX052", "B101BX052", "B952BX052"));
  36. }
  37. [Fact]
  38. public void CheckCountCombination()
  39. {
  40. Assert.Equal(3, Class1.GetCombinationsCountInRange("B101BX052", "B103BX052"));
  41. }
  42. [Fact]
  43. public void CheckMark()
  44. {
  45. Assert.Equal(true, Class1.CheckMark("B101BX052"));
  46. }
  47. [Fact]
  48. public void CheckNextMarkAfter()
  49. {
  50. Assert.Equal("B102BX052", Class1.GetNextMarkAfter("B101BX052"));
  51. }
  52. [Fact]
  53. public void CheckNextMarkAfterInRangeEqual()
  54. {
  55. Assert.Equal("B103BX052", Class1.GetNextMarkAfterInRange("B102BX052", "B101BX052", "B103BX052"));
  56. }
  57. #endregion
  58. #region Âûñîêîé ñëîæíîñòè
  59. [Fact]
  60. public void NullArgumentOnCheck()
  61. {
  62. Assert.Throws<ArgumentException>(() => Class1.CheckMark(null));
  63. }
  64. [Fact]
  65. public void NullArgumentOnNext()
  66. {
  67. Assert.Throws<ArgumentException>(() => Class1.GetNextMarkAfter(null));
  68. }
  69. [Fact]
  70. public void NullArgumentOnRange()
  71. {
  72. Assert.Throws<ArgumentException>(() => Class1.GetNextMarkAfterInRange(null,null,null));
  73. }
  74. [Fact]
  75. public void NullArgumentOnCount()
  76. {
  77. Assert.Throws<ArgumentException>(() => Class1.GetCombinationsCountInRange(null,null));
  78. }
  79. [Fact]
  80. public void WrongArgumentOnCheck()
  81. {
  82. Assert.Throws<ArgumentException>(() => Class1.CheckMark("A4560BC1233"));
  83. }
  84. #endregion
  85. }
  86. }