Ejemplo n.º 1
0
        public void NextToken_ForGivenValidBasicText_ReturnsExpectedTokens(string givenText, string expectedIdentifier, string expectedOpearator,
                                                                           TokenType expectedOperatorType, string expectedValue, TokenType expectedValueType)
        {
            using (var reader = new StringReader(givenText))
                using (var tokenizer = new Tokenizer(reader))
                {
                    var token1 = tokenizer.NextToken();
                    var token2 = tokenizer.NextToken();
                    var token3 = tokenizer.NextToken();

                    Assert.Equal(expectedIdentifier, token1.Value);
                    Assert.Equal(TokenType.Identifier, token1.Type);

                    Assert.Equal(expectedOpearator, token2.Value);
                    Assert.Equal(expectedOperatorType, token2.Type);

                    Assert.Equal(expectedValue, token3.Value);
                    Assert.Equal(expectedValueType, token3.Type);

                    Assert.False(tokenizer.CanRead());
                }
        }