123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- using REG_MARK_LIB;
- namespace UnitTests
- {
- /// <summary>
- /// Êëàññ òåñòîâ íèçêîé ñëîæíîñòè
- /// </summary>
- public class TestsOfLowDifficult
- {
- // Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå ÷èñëà â ñîñòàâå íîìåðà
- [Fact]
- public void TestGetNextMarkAfterWithCorrectData()
- {
- Assert.Equal("T357CK42", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("T356CK42"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå ïåðâîé áóêâû â ñîñòàâå íîìåðà
- [Fact]
- public void TestGetNextMarkAfterWithCorrectDataOnFirstLetter()
- {
- Assert.Equal("Y001OK52", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("T999OK52"));
- }
- // Òåñò ôóíêöèè CheckMark, ñ ïðàâèëüíûì íîìåðîì
- [Fact]
- public void TestMarkWithCorrectDataCheck()
- {
- Assert.True(REG_MARK_LIB.REG_MARK_LIB.CheckMark("a999aa99"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè èçíà÷àëüíîì íîìåðå íå âõîäÿùåì â äèàïàçîí (áîëüøå)
- [Fact]
- public void TestGetNextMarkAfterInRangeWithIncorrectDataBiggerThanEnd()
- {
- Assert.Equal("out of stock", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("X999YX52", "A001AA52", "X999OX52"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè íåêîððåêòíîì äèàïàçîíå
- [Fact]
- public void TestGetNextMarkAfterInRangeWithIncorrectDataIncorrectBounds()
- {
- Assert.Equal("out of stock", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("X999YX52", "X999OX52", "A001AA52"));
- }
- // Òåñò ôóíêöèè CheckMark, ñ íåïðàâèëüíûì íîìåðîì
- [Fact]
- public void TestMarkWithIncorrectDataCheckOnSecondNumber()
- {
- Assert.False(REG_MARK_LIB.REG_MARK_LIB.CheckMark("a999aa999"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå òðåòåé áóêâû â ñîñòàâå íîìåðà
- [Fact]
- public void TestGetNextMarkAfterWithCorrectDataOnThirdLetter()
- {
- Assert.Equal("A001OM42", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("X999OK42"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè èçíà÷àëüíîì íîìåðå íå âõîäÿùåì â äèàïàçîí (ìåíüøå)
- [Fact]
- public void TestGetNextMarkAfterInRangeWithIncorrectDataSmallerThanStart()
- {
- Assert.Equal("out of stock", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("A003OM42", "X999OX52", "X999XX52"));
- }
- // Òåñò ôóíêöèè GetCombinationsCountInRange, ñ îáû÷íûìè äàííûìè
- [Fact]
- public void TestGetCombinationsCountInRangeWithCorrectData()
- {
- Assert.Equal(2, REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("M356OK52", "M357OK52"));
- }
- // Òåñò ôóíêöèè GetCombinationsCountInRange, ñ ïåðåâåðíóòûìè ãðàíèöàìè
- [Fact]
- public void TestGetCombinationsCountInRangeWithCorrectDataReverse()
- {
- Assert.Equal(2, REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("M357OK52", "M356OK52"));
- }
- // Òåñò ôóíêöèè GetCombinationsCountInRange, ñ îäèíàêîâûìè ãðàíèöàìè
- [Fact]
- public void TestGetCombinationsCountInRangeWithCorrectDataEqualsBounds()
- {
- Assert.Equal(1, REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("M356OK52", "M356OK52"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfter, ïðîâåðêà íà èçìåíåíèå âòîðîé áóêâû â ñîñòàâå íîìåðà
- [Fact]
- public void TestGetNextMarkAfterWithCorrectDataOnSecondLetter()
- {
- Assert.Equal("A001OM42", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("X999OK42"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfterInRange, ñ êîððåêòíûìè äàííûìè
- [Fact]
- public void TestGetNextMarkAfterInRangeWithCorrectData()
- {
- Assert.Equal("A001PA42", REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("X999OX42", "A001AA42", "X999XX42"));
- }
- }
- /// <summary>
- /// Êëàññ òåñòîâ âûñîêîé ñëîæíîñòè
- /// </summary>
- public class TestsOfHighDifficult
- {
- // Òåñò ôóíêöèè CheckMark, ïðè ïåðåäà÷å null
- [Fact]
- public void TestCheckMarkOnNull()
- {
- Assert.Throws<ArgumentNullException>(() => REG_MARK_LIB.REG_MARK_LIB.CheckMark(null));
- }
- // Òåñò ôóíêöèè GetNextMarkAfterInRange, ïðè ïåðåäà÷å íå íîìåðà
- [Fact]
- public void TestGetNextMarkAfterInRangeOnNotMark()
- {
- Assert.Throws<ArgumentException>(() => REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfterInRange("Hello world!", "a999aa42", "a999aa42"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfter, ïðè ïåðåäà÷å íîìåðà, äëÿ êîòîðîãî íåò ñëåäóþùåãî íîìåðà
- [Fact]
- public void TestGetNextMarkAfterOnNotNextMark()
- {
- Assert.Throws<Exception>(() => REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("x999xx42"));
- }
- // Òåñò ôóíêöèè GetNextMarkAfter, ïðè ïåðåäà÷å íå íîìåðà
- [Fact]
- public void TestGetNextMarkAfterOnNotMark()
- {
- Assert.Throws<ArgumentException>(() => REG_MARK_LIB.REG_MARK_LIB.GetNextMarkAfter("Hello world!"));
- }
- // Òåñò ôóíêöèè GetCombinationsCountInRange, ïðè ïåðåäà÷å íå íîìåðà
- [Fact]
- public void TestGetCombinationsCountInRangeOnNotMark()
- {
- Assert.Throws<ArgumentException>(() => REG_MARK_LIB.REG_MARK_LIB.GetCombinationsCountInRange("Hello world!", "a999aa42"));
- }
- }
- }
|