示例#1
0
        public void TestAdditionDemo(int a, int b, int expected)
        {
            // Arrange - setup test ready to run
            //         - create instance of test classes
            var instance = new Addition();
            // Act     - run code to get 'actual' value
            var actual = instance.AddTwoNumbers(a, b);

            // Assert  - assert.ArEqual(actual, expected);
            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void OneAddedToOneIsTwo()
        {
            // arrange
            var one      = 1;
            var addition = new Addition();

            // act
            var result = addition.AddTwoNumbers(one, one);

            // assert
            Assert.Equal(2, result);
        }
示例#3
0
        public void Add_NegativeNumbers_returnNegativeValues()
        {
            //arrange
            Addition add         = new Addition();
            int      firstValue  = -4;
            int      secondValue = -6;
            int      expected    = -10;
            int      actual;

            //act
            actual = add.AddTwoNumbers(firstValue, secondValue);
            //assert
            Assert.AreEqual(expected, actual);
        }