UnitTest1.cs 713 B

12345678910111213141516171819202122232425
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using ClassLibrary4;
  4. namespace UnitTestProject1
  5. {
  6. [TestClass]
  7. public class UnitTest1
  8. {
  9. [TestMethod]
  10. public void TestMethod1()
  11. {
  12. double a = 1;
  13. double b = 2;
  14. double y = 3;
  15. double expected = 6;
  16. Class1 test = new Class1(); //Создание объекта класса
  17. double result = test.Resh(a, b, y); //Вызов метода класса
  18. Assert.AreEqual(expected, result); //Сравнение заранее верного ответа и полученого в ходе тестирования
  19. }
  20. }
  21. }