123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- namespace Tests
- {
- [TestClass]
- public class UnitTest1
- {
- //Positive
- [TestMethod]
- public void Sum21_and51_return72()
- {
- int a = 21;
- int b = 51;
- int except = 72;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Add(a, b);
- Assert.AreEqual(actual, except);
- }
- [TestMethod]
- public void Sub2345_from7645_return5300()
- {
- int a = 7645;
- int b = 2345;
- int except = 5300;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Subtract(a, b);
- Assert.AreEqual(actual, except);
- }
- [TestMethod]
- public void Mul44_by66_return2904()
- {
- int a = 44;
- int b = 66;
- int except = 2904;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Multiply(a, b);
- Assert.AreEqual(actual, except);
- }
- [TestMethod]
- public void Div9_by2_return4_5()
- {
- int a = 9;
- int b = 2;
- float except = 4.5f;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Divide(a, b);
- Assert.AreEqual(actual, except);
- }
- [TestMethod]
- public void Pow999_by0_return1()
- {
- int a = 999;
- int b = 0;
- int except = 1;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Power(a, b);
- Assert.AreEqual(actual, except);
- }
- //Negative
- [TestMethod]
- public void Sum3_and4_notreturn8()
- {
- int a = 3;
- int b = 4;
- int except = 8;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Add(a, b);
- Assert.AreNotEqual(actual, except);
- }
- [TestMethod]
- public void Sub4_from12_notreturn9()
- {
- int a = 12;
- int b = 4;
- int except = 9;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Subtract(a, b);
- Assert.AreNotEqual(actual, except);
- }
- [TestMethod]
- public void Mul5_by66_notreturn331()
- {
- int a = 5;
- int b = 66;
- int except = 331;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Multiply(a, b);
- Assert.AreNotEqual(actual, except);
- }
- [TestMethod]
- public void Div9_by3_notreturn4()
- {
- int a = 9;
- int b = 3;
- float except = 4;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Divide(a, b);
- Assert.AreNotEqual(actual, except);
- }
- [TestMethod]
- public void Pow5_by5_notreturn625()
- {
- int a = 5;
- int b = 5;
- int except = 625;
- var calculator = new Calculator.Calculator();
- var actual = calculator.Power(a, b);
- Assert.AreNotEqual(actual, except);
- }
- }
- }
|