コード例 #1
0
        public void GivenTokenQueueFactory_WhenNumberBeforeCurrency_ThenCurrencyAmount()
        {
            var lexer             = CreateLexer("10EUR");
            var tokenQueueFactory = new TokenQueueFactory();
            var queue             = tokenQueueFactory.Create(lexer);

            var token = queue.Dequeue();

            Assert.AreEqual(TokenType.CurrencyAmount, token.Type);
        }
コード例 #2
0
        public void GivenTokenQueueFactory_WhenMultipleMerge_ThenSuccess()
        {
            var lexer             = CreateLexer("€1 < 1BTC");
            var tokenQueueFactory = new TokenQueueFactory();
            var queue             = tokenQueueFactory.Create(lexer);

            var token = queue.Dequeue();

            Assert.AreEqual(TokenType.CurrencyAmount, token.Type);

            token = queue.Dequeue();
            Assert.AreEqual(TokenType.SmallerThan, token.Type);

            token = queue.Dequeue();
            Assert.AreEqual(TokenType.CurrencyAmount, token.Type);
        }
コード例 #3
0
        public void GivenTokenQueueFactory_WhenDequeue_ThenCorrectOrder()
        {
            var lexer             = CreateLexer(@"1 > ""2""");
            var tokenQueueFactory = new TokenQueueFactory();
            var queue             = tokenQueueFactory.Create(lexer);

            var token = queue.Dequeue();

            Assert.AreEqual(TokenType.Number, token.Type);

            token = queue.Dequeue();
            Assert.AreEqual(TokenType.LargerThan, token.Type);

            token = queue.Dequeue();
            Assert.AreEqual(TokenType.String, token.Type);
        }