public void TestMultiplying() { //Arrange DevOps_Test_Demo_Project.Calculator.Calculator calculator = new DevOps_Test_Demo_Project.Calculator.Calculator(); // Act int integerResult = calculator.Multiply(4, 2); //Assert Assert.IsNotNull(integerResult); Assert.AreEqual(8, integerResult); // Testing integers }
public void TestAdding() { //Arrange DevOps_Test_Demo_Project.Calculator.Calculator calculator = new DevOps_Test_Demo_Project.Calculator.Calculator(); // Act int integerResult = calculator.Add(4, 2); //Assert Assert.IsNotNull(integerResult); // Testing integers Assert.AreEqual(6, integerResult); }
public void TestDividing() { //Arrange DevOps_Test_Demo_Project.Calculator.Calculator calculator = new DevOps_Test_Demo_Project.Calculator.Calculator(); // Act int integerResult = calculator.Divide(4, 2); //Assert Assert.IsNotNull(integerResult); Assert.AreEqual(2, integerResult); // Testing integers Assert.AreEqual(0, calculator.Divide(5, 0)); //Divide by zero }
static void Main(string[] args) { Calculator.Calculator calc = new Calculator.Calculator(); int x = 4, y = 2; Console.WriteLine("The sum of {0} and {1} is {2}", x, y, calc.Add(x, y)); Console.WriteLine("The difference of {0} and {1} is {2}", x, y, calc.Subtract(x, y)); Console.WriteLine("The product of {0} and {1} is {2}", x, y, calc.Multiply(x, y)); //This is a test Console.WriteLine("The quotient of {0} and {1} is {2}", x, y, calc.Divide(x, y)); }