Exemplo n.º 1
0
        static void Main()
        {
            Calculator calc = new Calculator();
			Console.WriteLine(calc.Calculate("((2+7)/3+(14-3)*4)/2"));
			Console.WriteLine(calc.Calculate("((2+7)/3+(14-3)*4)"));
			Console.ReadLine();
        }
Exemplo n.º 2
0
		public void Calculate_ValidOperationString_ReturnsAnswer2()
		{
			var calc = new Calculator();
			var result = calc.Calculate("((2+7)/3+(14-3)*4)/2");
			var expectation = 23.5;
			Assert.AreEqual(expectation, result);
		}
Exemplo n.º 3
0
		public void Calculate_ValidOperationString_ReturnsAnswer1()
		{
			var calc = new Calculator();
			var result = calc.Calculate("3+2");
			var expectation = 5;
			Assert.AreEqual(expectation, result);
		}
Exemplo n.º 4
0
 public void Calculate_EmptyString_ThrowsEmptyStringException()
 {
     var calc = new Calculator();
     Assert.Throws<EmptyStringException>(() => calc.Calculate(""));
 }