123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- using UnitTestingCalculator;
- namespace UnitTests
- {
- [TestClass]
- public class UnitTest
- {
- /// <summary>
- /// Ïîëîæèòåëüíîå òåñòèðîâàíèå ìåòîäà Cëîæåíèÿ
- /// </summary>
- [TestMethod]
- public void Addition_15plus2_Return17()
- {
- double firstNum = 15;
- double secondNum = 2.1;
- double except = 17.1;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Addition();
- Assert.AreEqual(except, result);
- }
- /// <summary>
- /// Íåãàòèâíîå òåñòèðîâàíèå ìåòîäà Cëîæåíèÿ
- /// </summary>
- [TestMethod]
- public void Addition_15plus2_Notreturn10()
- {
- double firstNum = 15;
- double secondNum = 2.1;
- double except = 10;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Addition();
- Assert.AreNotEqual(except, result);
- }
- /// <summary>
- /// Ïîëîæèòåëüíîå òåñòèðîâàíèå ìåòîäà Âû÷èòàíèÿ
- /// </summary>
- [TestMethod]
- public void Subtraction_15minus5_Return10()
- {
- double firstNum = 15;
- double secondNum = 5;
- double except = 10;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Subtraction();
- Assert.AreEqual(except, result);
- }
- /// <summary>
- /// Íåãàòèâíîå òåñòèðîâàíèå ìåòîäà Âû÷èòàíèÿ
- /// </summary>
- [TestMethod]
- public void Subtraction_15minus5_Notreturn20()
- {
- double firstNum = 15;
- double secondNum = 5;
- double except = 20;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Subtraction();
- Assert.AreNotEqual(except, result);
- }
- /// <summary>
- /// Ïîëîæèòåëüíîå òåñòèðîâàíèå ìåòîäà Óìíîæåíèÿ
- /// </summary>
- [TestMethod]
- public void Multiplication_Multiply20And2_Return40()
- {
- double firstNum = 20;
- double secondNum = 2;
- double except = 40;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Multiplication();
- Assert.AreEqual(except, result);
- }
- /// <summary>
- /// Íåãàòèâíîå òåñòèðîâàíèå ìåòîäà Óìíîæåíèÿ
- /// </summary>
- [TestMethod]
- public void Multiplication_MultiplyMinus10And2_Notreturn20()
- {
- double firstNum = -10;
- double secondNum = 2;
- double except = 20;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Multiplication();
- Assert.AreNotEqual(except, result);
- }
- /// <summary>
- /// Ïîëîæèòåëüíîå òåñòèðîâàíèå ìåòîäà Äåëåíèÿ
- /// </summary>
- [TestMethod]
- public void Division_Divide14And2_Return7()
- {
- double firstNum = 14;
- double secondNum = 2;
- double except = 7;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Division();
- Assert.AreEqual(except, result);
- }
- /// <summary>
- /// Íåãàòèâíîå òåñòèðîâàíèå ìåòîäà Äåëåíèÿ
- /// </summary>
- [TestMethod]
- public void Division_Divide14And0_Notreturn14()
- {
- double firstNum = 14;
- double secondNum = 0;
- double except = 14;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Division();
- Assert.AreNotEqual(except, result);
- }
- /// <summary>
- /// Ïîëîæèòåëüíîå òåñòèðîâàíèå ìåòîäà Ñòåïåíè
- /// </summary>
- [TestMethod]
- public void Exponentiation_5power3_Return125()
- {
- double firstNum = 5;
- double secondNum = 3;
- double except = 125;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Exponentiation();
- Assert.AreEqual(except, result);
- }
- /// <summary>
- /// Íåãàòèâíîå òåñòèðîâàíèå ìåòîäà Ñòåïåíè
- /// </summary>
- [TestMethod]
- public void Exponentiation_10power0_Notreturn10()
- {
- double firstNum = 10;
- double secondNum = 0;
- double except = 10;
- Calculator example = new Calculator(firstNum, secondNum);
- double result = example.Exponentiation();
- Assert.AreNotEqual(except, result);
- }
- }
- }
|