コード例 #1
0
        public void DivisionTest()
        {
            CalculatorClass sut            = new CalculatorClass();
            var             actualQuotient = sut.Quotient(10.0, 1.0);

            Assert.Equal(10, actualQuotient);
        }
コード例 #2
0
        public void SubtractionTest()
        {
            CalculatorClass sut = new CalculatorClass();
            var             actualDifference = sut.Difference(10.0, 5.0);

            Assert.Equal(5, actualDifference);
        }
コード例 #3
0
        public void MultiplicationTest()
        {
            CalculatorClass sut           = new CalculatorClass();
            var             actualProduct = sut.Product(10.0, 10.0);

            Assert.Equal(100, actualProduct);
        }
コード例 #4
0
        public void VerifyDivideMethodReturnsCorrectDividendOfTwoNumbers()
        {
            CalculatorClass obj4 = new CalculatorClass();

            obj4.Add(4, 5);
            Assert.AreEqual(0, obj4.quotient);
        }
コード例 #5
0
        public void VerifyMultiplyMethodReturnsCorrectProductOfTwoNumbers()
        {
            CalculatorClass obj3 = new CalculatorClass();

            obj3.Multiply(4, 5);
            Assert.AreEqual(20, obj3.product);
        }
コード例 #6
0
        public void VerifySubtractMethodReturnsCorrectDifferenceOfTwoNumbers()
        {
            CalculatorClass obj2 = new CalculatorClass();

            obj2.Subtract(4, 5);
            Assert.AreEqual(-1, obj2.diff);
        }
コード例 #7
0
        public void VerifyAddMethodReturnsCorrectSumOfTwoNumbers()
        {
            //Arrange..set up the test
            CalculatorClass obj = new CalculatorClass();

            //Act...actionable event
            obj.Add(4, 5);
            //Assert..expected result
            Assert.AreEqual(9, obj.sum);
        }
コード例 #8
0
        public void SumTest()
        {
            // Arrange
            CalculatorClass sut = new CalculatorClass();

            // Act
            var actualSum = sut.Sum(2.5, 2.5);

            // Assert
            Assert.Equal(5, actualSum);
        }
コード例 #9
0
        public void 傳入1和2得到結果3()
        {
            var calc   = new CalculatorClass();
            var a      = 1;
            var b      = 2;
            var expect = 3;

            var result = calc.Add(a, b);

            Assert.AreEqual(expect, result);
        }
コード例 #10
0
        public void 傳入兩個浮點數()
        {
            var calc   = new CalculatorClass();
            var a      = 50.1;
            var b      = 70.1;
            var expect = 120.2;

            var result1 = Math.Round(calc.Add1(a, b));

            Assert.AreEqual(expect, result1);
        }
コード例 #11
0
 public void Initialize()
 {
     calculator = new CalculatorClass();
 }