using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using Calculation; namespace UnitTestProject1 { [TestClass] public class UnitTest1 { Calculator cs; [TestMethod] public void TestMethod1() { cs = new Calculator(); Assert.AreEqual(cs.Calc(13M, 14), cs.Calc(13M, 15)); } [TestMethod] public void TestMethod2() { cs = new Calculator(); Assert.AreEqual(cs.Calc(0M, 0), cs.Calc(0M, 2)); } [TestMethod] public void TestMethod3() { cs = new Calculator(); Assert.AreEqual(0, cs.Calc(0M, 0)); } [TestMethod] public void TestMethod4() { cs = new Calculator(); Assert.AreEqual(0, cs.Calc(122.21M, Convert.ToInt32(10 * 0.2))); } [TestMethod] public void TestMethod5() { cs = new Calculator(); int count = Convert.ToInt32(10 * 0.2); decimal price = 122.21M; Assert.AreEqual(1, cs.Calc(price * 5, count)); } [TestMethod] public void TestMethod6() { cs = new Calculator(); Assert.AreEqual(0, cs.Calc(0M, Convert.ToInt32(10 * 0.5))); } [TestMethod] public void TestMethod7() { cs = new Calculator(); Assert.AreEqual(0, cs.Calc(12.5M, Convert.ToInt32(10 * 0.2))); } [TestMethod] public void TestMethod8() { cs = new Calculator(); Assert.AreEqual(15, cs.Calc(0.3M, 10)); } [TestMethod] public void TestMethod9() { cs = new Calculator(); Assert.AreEqual(16, cs.Calc(750, 17)); } [TestMethod] public void TestMethod10() { cs = new Calculator(); Assert.AreEqual(0, cs.Calc(750, 0)); } } }