예제 #1
0
        public void ShouldApplyOperatorSuccefully()
        {
            CalculatorContainer container = new CalculatorContainer();
            CalculatorExecutor  executor  = new CalculatorExecutor();

            container.PushItem(5);
            container.PushItem(7);
            container.PushItem(8);
            executor.ApplyOperator(container, "+");
            Assert.AreEqual("5;15", container.PrettyDisplay());
            container.PushItem(10);
            executor.ApplyOperator(container, "-");
            Assert.AreEqual("5;-5", container.PrettyDisplay());
            executor.ApplyOperator(container, "*");
            Assert.AreEqual("-25", container.PrettyDisplay());
        }
        public void ShouldDisplayStack()
        {
            CalculatorContainer container = new CalculatorContainer();

            container.PushItem(5);
            container.PushItem(7);

            Assert.AreEqual("5;7", container.PrettyDisplay());
        }
예제 #3
0
 public string GetStack()
 {
     return(CalculatorContainer.PrettyDisplay());
 }