예제 #1
0
        public void GetResultTestDiv()
        {
            var calculator = new Calculator();

            calculator.Operation = "/";
            calculator.V1        = 6;
            calculator.V2        = 2;
            var result = calculator.GetResult();

            Assert.AreEqual(3, result);
        }
예제 #2
0
        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());
        }
예제 #3
0
        public void GetResultTestMul()
        {
            var calculator = new Calculator();

            calculator.Operation = "*";
            calculator.V1        = 3;
            calculator.V2        = 2;
            var result = calculator.GetResult();

            Assert.AreEqual(6, result);
        }