public void Calculate_factorial_for_current_number() { var sut = new RPNCalculator(); Tuple<IEnumerable<int>, int> result = null; sut.Result += _ => result = _; sut.Calculate(new Tuple<string, int>("!", 3)); Assert.AreEqual(new int[] {}, result.Item1); Assert.AreEqual(6, result.Item2); }
public void Calculate_factorial_for_current_number() { var sut = new RPNCalculator(); Tuple <IEnumerable <int>, int> result = null; sut.Result += _ => result = _; sut.Calculate(new Tuple <string, int>("!", 3)); Assert.AreEqual(new int[] {}, result.Item1); Assert.AreEqual(6, result.Item2); }
public void Add_number_to_single_value_stack() { var initialStack = new Stack<int>(); initialStack.Push(2); var sut = new RPNCalculator(initialStack); Tuple<IEnumerable<int>, int> result = null; sut.Result += _ => result = _; sut.Calculate(new Tuple<string, int>("+", 3)); Assert.AreEqual(new int[]{}, result.Item1); Assert.AreEqual(5, result.Item2); }
public void Add_number_to_single_value_stack() { var initialStack = new Stack <int>(); initialStack.Push(2); var sut = new RPNCalculator(initialStack); Tuple <IEnumerable <int>, int> result = null; sut.Result += _ => result = _; sut.Calculate(new Tuple <string, int>("+", 3)); Assert.AreEqual(new int[] {}, result.Item1); Assert.AreEqual(5, result.Item2); }
public void More_basic_operations(int leftOperand, string op, int number, int calcResult) { var initialStack = new Stack <int>(); initialStack.Push(leftOperand); var sut = new RPNCalculator(initialStack); Tuple <IEnumerable <int>, int> result = null; sut.Result += _ => result = _; sut.Calculate(new Tuple <string, int>(op, number)); Assert.AreEqual(new int[] { }, result.Item1); Assert.AreEqual(calcResult, result.Item2); }
public void More_basic_operations(int leftOperand, string op, int number, int calcResult) { var initialStack = new Stack<int>(); initialStack.Push(leftOperand); var sut = new RPNCalculator(initialStack); Tuple<IEnumerable<int>, int> result = null; sut.Result += _ => result = _; sut.Calculate(new Tuple<string, int>(op, number)); Assert.AreEqual(new int[] { }, result.Item1); Assert.AreEqual(calcResult, result.Item2); }