UnitTest1.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using ClassLibrary1;
  2. namespace TestProject1
  3. {
  4. [TestClass]
  5. public class UnitTest1
  6. {
  7. [TestMethod]
  8. public void TestMethod1()//ïîçèòèâíûé íà ïðîâåðêó òîãî, ÷òî ñëîâî îïðåäåëÿåòñÿ êîððåêòíî
  9. {
  10. string stroka = "ìàìà ÿ êîò";
  11. string expected = "ìàìà";
  12. Class1 b = new Class1();
  13. string actual = b.str(stroka);
  14. Assert.AreEqual(expected, actual);
  15. }
  16. [TestMethod]
  17. public void TestMethod4()//ïîçèòèâíûé íà ïðîâåðêó òîãî, ÷òî â ñòðîêå íàõîäÿòñÿ çíà÷åíèÿ, åñëè ïåðåäàâàòü åìó ñòðîêó ñ ";"
  18. {
  19. string stroka = "ìàìà;ÿ;êîò";
  20. string expected = "ìàìà";
  21. Class1 b = new Class1();
  22. string actual = b.str(stroka);
  23. Assert.AreEqual(expected, actual);
  24. }
  25. [TestMethod]
  26. public void TestMethod3()//ïîçèòèâíûé íà ïðîâåðêó âîçâðàòà íå íóëåâîãî çíà÷åíèÿ
  27. {
  28. string stroka = "ìàìà ÿ êîò";
  29. Class1 b = new Class1();
  30. string actual = b.str(stroka);
  31. Assert.IsNotNull(actual);
  32. }
  33. [TestMethod]
  34. public void TestMethod2()//íåãàòèâíûé
  35. {
  36. string stroka = "ìàìà ÿ êîò";
  37. string expected = "ÿ";
  38. Class1 b = new Class1();
  39. string actual = b.str(stroka);
  40. Assert.AreNotEqual(expected, actual);
  41. }
  42. }
  43. }