public void Addition_test() {//Arrange Section - We initialize variables and set its values int expectedresult = 24; int num1 = 20; int num2 = 4; //Act Section - We invoke tge mehotds we want tot test int actualresult = CalculationOperation.Add(num1, num2); //Assert Section - We verify the method we want to verify if the method behaves as per expected Assert.AreEqual(expectedresult, actualresult); Console.WriteLine("This is the test method"); }
public void Division_Test() { //Arrange section: Initialize the variables and set its value int expectedResult = 5; int num1 = 20; int num2 = 4; //Act section: call the intended method that we want to test int actionResult = CalculationOperation.Divide(num1, num2); //Assert section - We verify weather our test suceeded or not using Assert class Assert.AreEqual(expectedResult, actionResult); Console.WriteLine("This is test method for division"); }
public void Multiply_test() { //Arrange Section- we initialize variables and set its values. int expectedResult = 24; int num1 = 6; int num2 = 4; //Act Section- We invoke the method we want to test. int actualResult = CalculationOperation.Multiply(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"); }