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(() => RegMark.GetNextMarkAfter("x999xx72")); } [TestMethod] public void GetNextMarkAfterInRange_UNCorrectRange() { Assert.ThrowsException(() => RegMark.GetNextMarkAfterInRange("a909aa72", "a999aa72", "a009aa72")); } [TestMethod] public void GetCombinationsCountInRange_UNCorrectRange() { Assert.ThrowsException(() => RegMark.GetCombinationsCountInRange("a999aa72", "a909aa72")); } [TestMethod] public void GetCombinationsCountInRange_UNCorrectMark() { Assert.ThrowsException(() => RegMark.GetCombinationsCountInRange("a909al72", "a909ka72")); } [TestMethod] public void GetNextMarkAfter_UNCorrectMark() { Assert.ThrowsException(() => RegMark.GetNextMarkAfter("a909al72")); } } }