123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- using Microsoft.VisualStudio.TestTools.UnitTesting;
- using TestSessionLib;
- namespace TestProject
- {
- /*Ãîâîðèëè, ÷òî íóæíî 5 ïðîñòûõ è 5 ñëîæíûõ òåñòîâ*/
- [TestClass]
- public class UnitTest
- {
- /*Òåñòû íèçêîé ñëîæíîñòè*/
- /// <summary>
- /// Ïðîâåðêà, ÷òî ìåòîä CheckMark âîçâðàùàåò true ïðè êîððåêòíîì íîìåðå
- /// </summary>
- [TestMethod]
- public void CheckMark_IsTrue()
- {
- Assert.IsTrue(REG_MARK_LIB.CheckMark("a999aa052"));
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî ìåòîä CheckMark âîçâðàùàåò äàííûå ôîðìàòà boolean.
- /// </summary>
- [TestMethod]
- public void CheckMark_IsBoolean()
- {
- Assert.IsInstanceOfType(REG_MARK_LIB.CheckMark("a999aa052"), typeof(Boolean));
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî ïðè êîððåêòíûõ äàííûõ ìåòîä GetNextMarkAfter âîçâðàùàåò
- /// ïðàâèëüíûé ðåãèñòðàöèîííûé çíàê.
- /// </summary>
- [TestMethod]
- public void NextMarkAfter_AreEqual()
- {
- Assert.AreEqual(REG_MARK_LIB.GetNextMarkAfter("a125aa052"), "a126aa052");
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî ïðè êîððåêòíûõ äàííûõ ìåòîä GetNextMarkAfterInRange âîçâðàùàåò
- /// ïðàâèëüíûé ðåãèñòðàöèîííûé çíàê.
- /// </summary>
- [TestMethod]
- public void NextMarkAfterInRange_AreEqual()
- {
- Assert.AreEqual(REG_MARK_LIB.GetNextMarkAfterInRange("a125aa052", "a000aa052", "a999aa052"), "a126aa052");
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî ïðè êîððåêòíûõ äàííûõ ìåòîä GetCombinationsCountInRange âîçâðàùàåò
- /// ïðàâèëüíûé ðåãèñòðàöèîííûé çíàê.
- /// </summary>
- [TestMethod]
- public void CombinationsCountInRange_AreEqual()
- {
- Assert.AreEqual(REG_MARK_LIB.GetCombinationsCountInRange("a000aa053", "a003aa053"), 4);
- }
- /*Òåñòû âûñîêîé ñëîæíîñòè*/
- /// <summary>
- /// Ïðîâåðêà, ÷òî åñëè â ìåòîäå GetNextMarkAfterInRange óêàçàòü äèàïîçîí
- /// ðåãèñòðàöèîííûõ çíàêîâ â óáûâàþùåì ïîðÿäêå, âîçíèêàåò èñêëþ÷åíèå.
- /// </summary>
- [TestMethod]
- public void GetNextMarkAfterInRange_RangeNotOrder()
- {
- Assert.ThrowsException<System.ArgumentException>(() => REG_MARK_LIB.GetNextMarkAfterInRange("à123àà052", "a999aa052", "a000aa052"));
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî åñëè â ìåòîäå GetCombinationsCountInRange óêàçàòü äèàïîçîí
- /// ðåãèñòðàöèîííûõ çíàêîâ â óáûâàþùåì ïîðÿäêå, âîçíèêàåò èñêëþ÷åíèå.
- /// </summary>
- [TestMethod]
- public void CombinationsCountInRange_RangeNotBy()
- {
- Assert.ThrowsException<System.ArgumentOutOfRangeException>(() => REG_MARK_LIB.GetCombinationsCountInRange("a010aa799", "a003aa799"));
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî ìåòîä GetNextMarkAfter ïðèíèìàåò òîëüêî âåðíûå ïàðàìåòðû.
- /// </summary>
- [TestMethod]
- public void GetNextMarkAfter_InvalidParametr()
- {
- Assert.ThrowsException<System.ArgumentException>(() => REG_MARK_LIB.GetNextMarkAfter("a999aa999"));
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî ìåòîä GetNextMarkAfter ïðèíèìàåò òîëüêî âåðíûå ïàðàìåòðû.
- /// </summary>
- [TestMethod]
- public void GetNextMarkAfterInRange_InvalidParametr()
- {
- Assert.ThrowsException<System.ArgumentException>(() => REG_MARK_LIB.GetNextMarkAfterInRange("ö123öó052", "a000aa052", "a999aa052"));
- }
- /// <summary>
- /// Ïðîâåðêà, ÷òî ìåòîä GetNextMarkAfter ïðèíèìàåò òîëüêî âåðíûå ïàðàìåòðû.
- /// </summary>
- [TestMethod]
- public void GetCombinationsCountInRange_InvalidParametr()
- {
- Assert.ThrowsException<System.ArgumentException>(() => REG_MARK_LIB.GetCombinationsCountInRange("12345678", "a003aa053"));
- }
- }
- }
|