123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using System;
- using REG_MARK_LIB;
- namespace REG_MARK_TEST
- {
- [TestClass]
- public class UnitTest
- {
- [TestMethod]
- public void CheckMark_CorrectMark_True()
- {
- string mark = "a001aa52";
- bool result = RegMark.CheckMark(mark);
- Assert.IsTrue(result);
- }
- [TestMethod]
- public void CheckMark_UNCorrectMark_False()
- {
- string mark = "a001aa";
- bool result = RegMark.CheckMark(mark);
- Assert.IsFalse(result);
- }
- [TestMethod]
- public void GetNextMarkAfter_NextMark_Equel()
- {
- string mark = "x999ax52";
- string expected = "x001bx52";
- string result = RegMark.GetNextMarkAfter(mark);
- Assert.AreEqual(expected, result);
- }
- [TestMethod]
- public void GetNextMarkAfter_NextMark_NotEquel()
- {
- string mark = "x998bx52";
- string expected = "x001bx52";
- string result = RegMark.GetNextMarkAfter(mark);
- Assert.AreNotEqual(expected, result);
- }
- [TestMethod]
- public void GetCombinationsCountInRange_1001Range_IsTrue()
- {
- int expected = 1001;
- int result = RegMark.GetCombinationsCountInRange("a001aa52","b001aa52");
- Assert.IsTrue(expected == result);
- }
- [TestMethod]
- public void GetCombinationsCountInRange_ZeroRange_IsTrue()
- {
- int expected = 1;
- int result = RegMark.GetCombinationsCountInRange("a001aa52", "a001aa52");
- Assert.IsTrue(expected == result);
- }
- [TestMethod]
- public void GetNextMarkAfterInRange_ZeroRange_IsTrue()
- {
- string expected = "out of stock";
- string result = RegMark.GetNextMarkAfterInRange("a555xx52", "a545xx52", "a550xx52");
- Assert.IsTrue(result == expected);
- }
- [TestMethod]
- public void GetNextMarkAfterInRange_NextPrevMark_IsTrue()
- {
- string expected = "a556xx52";
- string result = RegMark.GetNextMarkAfterInRange("a555xx52", "a545xx52", "a570xx52");
- Assert.IsTrue(result == expected);
- }
- [TestMethod]
- public void GetNextMarkAfterInRange_NextRangeMark_IsTrue()
- {
- string expected = "a545xx52";
- string result = RegMark.GetNextMarkAfterInRange("a530xx52", "a545xx52", "a570xx52");
- Assert.IsTrue(result == expected);
- }
- [TestMethod]
- public void GetNextMarkAfterInRange_TypeIsString()
- {
- Assert.IsInstanceOfType(RegMark.GetNextMarkAfterInRange("a530xa52", "a545xx52", "a570xx52"), typeof(string));
- }
-
- [TestMethod]
- public void GetNextMarkAfter_LastNextNumber()
- {
- Assert.ThrowsException<System.Exception>(() => RegMark.GetNextMarkAfter("x999xx72"));
- }
- [TestMethod]
- public void GetNextMarkAfterInRange_UNCorrectRange()
- {
- Assert.ThrowsException<System.Exception>(() => RegMark.GetNextMarkAfterInRange("a909aa72", "a999aa72", "a009aa72"));
- }
- [TestMethod]
- public void GetCombinationsCountInRange_UNCorrectRange()
- {
- Assert.ThrowsException<System.Exception>(() => RegMark.GetCombinationsCountInRange("a999aa72", "a909aa72"));
- }
- [TestMethod]
- public void GetCombinationsCountInRange_UNCorrectMark()
- {
- Assert.ThrowsException<System.Exception>(() => RegMark.GetCombinationsCountInRange("a909al72", "a909ka72"));
- }
- [TestMethod]
- public void GetNextMarkAfter_UNCorrectMark()
- {
- Assert.ThrowsException<System.Exception>(() => RegMark.GetNextMarkAfter("a909al72"));
- }
- }
- }
|