public void GetResultTestDiv() { var calculator = new Calculator(); calculator.Operation = "/"; calculator.V1 = 6; calculator.V2 = 2; var result = calculator.GetResult(); Assert.AreEqual(3, result); }
public void GetResultTestDiv_V1小於等於0_Exception() { var calculator = new Calculator(); calculator.Operation = "/"; calculator.V1 = 0; calculator.V2 = 2; var result = Assert.Catch <Exception>(() => calculator.GetResult()); StringAssert.Contains("V1 應該大於0", result.ToString()); }
public void GetResultTestMul() { var calculator = new Calculator(); calculator.Operation = "*"; calculator.V1 = 3; calculator.V2 = 2; var result = calculator.GetResult(); Assert.AreEqual(6, result); }