public void TestMethodTienDienDataDriven() { SourceCode.SomeCode obj = new SourceCode.SomeCode(); int socu = Convert.ToInt32(TestContext.DataRow[0]); int somoi = Convert.ToInt32(TestContext.DataRow[1]); Double Expected = Convert.ToDouble(TestContext.DataRow[2]); Double Actual = obj.TinhTienDien(socu, somoi); Assert.AreEqual(Expected, Actual); }
public void TestTinhTienDienThrowExpected() { Exception ExceptedException = null; try { SourceCode.SomeCode obj = new SourceCode.SomeCode(); int chisocu = Convert.ToInt32(TestContext.DataRow[0]); int chisomoi = Convert.ToInt32(TestContext.DataRow[1]); double Expected = Convert.ToDouble(TestContext.DataRow[2]); double Actual = obj.TinhTienDien(chisocu, chisomoi); Assert.AreEqual(Expected, Actual); } catch (Exception ex) { ExceptedException = ex; } Assert.IsNotNull(ExceptedException); }