public void TestDivision() { var cal = new DoCalculate(); var result = cal.DoOperation(5, 2, "/"); Assert.AreEqual(2.5d, result); }
public void TestSubtraction() { var cal = new DoCalculate(); var result = cal.DoOperation(5, 2, "-"); Assert.AreEqual(3, result); }
public void TestMultiplication() { var cal = new DoCalculate(); var result = cal.DoOperation(2, 5, "*"); Assert.AreEqual(10, result); }
public void TestAddition() { var cal = new DoCalculate(); var result = cal.DoOperation(2, 5, "+"); Assert.AreEqual(7, result); }
static void Main(string[] args) { // Display title as the C# console calculator app. Console.WriteLine("Welcome to Console Calculator.\n"); // Declare variables and Ask the User to enter inputs. double input_1 = Convert.ToDouble(Console.ReadLine()); double input_2 = Convert.ToDouble(Console.ReadLine()); // Ask the user to enter an operator. Console.WriteLine("Enter an operator:"); string op = Console.ReadLine(); var cal = new DoCalculate(); Console.WriteLine(cal.DoOperation(input_1, input_2, op)); }