示例#1
0
        public void NotFail()
        {
            NumberToken command = new NumberToken();
            var         result  = command.Process(new InputStack());

            Assert.Null(result);
        }
示例#2
0
        public void ReturnNumberWithDigitInput(string text, int expectedResultValue)
        {
            NumberToken command = new NumberToken();
            var         stack   = new InputStack(text);
            var         result  = command.Process(stack);

            Assert.NotNull(result);
            Assert.Equal(expectedResultValue, result.Value);
            Assert.Equal(0, result.Score);
        }
示例#3
0
        public void ReturnMultipleResultsNumberWithDigitInput(string text, params int[] expectedResultValues)
        {
            NumberToken command = new NumberToken();
            var         stack   = new InputStack(text);

            Assert.Equal(expectedResultValues.Length, stack.Count);
            for (int i = 0; i < stack.Count; i++)
            {
                var result = command.Process(stack);

                stack.Pop();

                Assert.NotNull(result);
                Assert.Equal(expectedResultValues[i], result.Value);
                Assert.Equal(0, result.Score);
            }
        }