Esempio n. 1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            int num1   = Convert.ToInt32(txtNum1.Text);
            int num2   = Convert.ToInt32(txtNum2.Text);
            int result = CalculationOperation.Add(num1, num2);

            lblResult.Text = result.ToString();
        }
Esempio n. 2
0
        public void TestMethod1()
        {
            //Arrange Section- we initialize variables and set its values.
            int expectedResult = 24;
            int num1           = 20;
            int num2           = 4;

            //Act Section- We invoke the method we want to test.
            int actualResult = CalculationOperation.Add(num1, num2);

            //Assert Section- we verify the method that we want to verify if the emthod behaves as per expected
            Assert.AreEqual(expectedResult, actualResult);
            Console.WriteLine("This is the test method for addition");
        }