UnitTest1.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using ConsoleApp1;
  2. using System.Security.Cryptography.X509Certificates;
  3. namespace Test
  4. {
  5. [TestClass]
  6. public class UnitTest1
  7. {
  8. [TestMethod]
  9. public void Sum_AreEqual()
  10. {
  11. double x = 4;
  12. double y = 6;
  13. double except = 10;
  14. double actual = Calculate.Sum(x, y);
  15. Assert.AreEqual(except, actual);
  16. }
  17. [TestMethod]
  18. public void Sum_AreNotEqual()
  19. {
  20. double x = 4;
  21. double y = -6;
  22. double except = 10;
  23. double actual = Calculate.Sum(x, y);
  24. Assert.AreNotEqual(except, actual);
  25. }
  26. [TestMethod]
  27. public void Subtraction_AreEqual()
  28. {
  29. double x = 4;
  30. double y = 6;
  31. double except = -2;
  32. double actual = Calculate.Subtraction(x, y);
  33. Assert.AreEqual(except, actual);
  34. }
  35. [TestMethod]
  36. public void Subtraction_AreNotEqual()
  37. {
  38. double x = 4;
  39. double y = 6;
  40. double except = 2;
  41. double actual = Calculate.Subtraction(x, y);
  42. Assert.AreNotEqual(except, actual);
  43. }
  44. [TestMethod]
  45. public void Multiplication_AreEqual()
  46. {
  47. double x = -1;
  48. double y = -3;
  49. double except = 3;
  50. double actual = Calculate.Multiplication(x, y);
  51. Assert.AreEqual(except, actual);
  52. }
  53. [TestMethod]
  54. public void Multiplication_AreNotEqual()
  55. {
  56. double x = 0;
  57. double y = 6;
  58. double except = 6;
  59. double actual = Calculate.Multiplication(x, y);
  60. Assert.AreNotEqual(except, actual);
  61. }
  62. [TestMethod]
  63. public void Division_AreEqual()
  64. {
  65. double x = 0;
  66. double y = 5;
  67. double except = 0;
  68. double actual = Calculate.Division(x, y);
  69. Assert.AreEqual(except, actual);
  70. }
  71. [TestMethod]
  72. public void Division_AreNotEqual()
  73. {
  74. double x = -100;
  75. double y = 10;
  76. double except = 10;
  77. double actual = Calculate.Division(x, y);
  78. Assert.AreNotEqual(except, actual);
  79. }
  80. [TestMethod]
  81. public void Exponentiation_AreEqual()
  82. {
  83. double x = 2;
  84. double y = 0;
  85. double except = 1;
  86. double actual = Calculate.Exponentiation(x, y);
  87. Assert.AreEqual(except, actual);
  88. }
  89. [TestMethod]
  90. public void Exponentiation_AreNotEqual()
  91. {
  92. double x = 5;
  93. double y = 2;
  94. double except = 26;
  95. double actual = Calculate.Exponentiation(x, y);
  96. Assert.AreNotEqual(except, actual);
  97. }
  98. }
  99. }