Ejemplo n.º 1
0
        public void StatementBaseFindFirstOccurenceOfShouldReturnNullIfNoOccurenceFound()
        {
            IStatementContext context = Mocker.DynamicMock <IStatementContext>();

            IList <TokenBase> input = new List <TokenBase>();

            input.Add(TokenCreator.Create <PublicModifierToken>());
            input.Add(TokenCreator.Create <SpaceToken>());
            input.Add(TokenCreator.Create <ClassToken>());
            input.Add(TokenCreator.Create <SpaceToken>());
            input.Add(TokenCreator.Create <IdentifierToken>("Test"));

            StatementBaseImpl imp = new StatementBaseImpl(input, context);

            Assert.IsNull(imp.OccurenceOf <TabToken>());
        }
Ejemplo n.º 2
0
        public void StatementBaseFindFirstOccurenceOfShouldReturnFirstOccurenceOfTokenType()
        {
            IStatementContext context = Mocker.DynamicMock <IStatementContext>();

            IList <TokenBase> input = new List <TokenBase>();

            input.Add(TokenCreator.Create <PublicModifierToken>());
            input.Add(TokenCreator.Create <SpaceToken>());
            TokenBase expected = TokenCreator.Create <ClassToken>();

            input.Add(expected);
            input.Add(TokenCreator.Create <SpaceToken>());
            input.Add(TokenCreator.Create <IdentifierToken>("Test"));

            StatementBaseImpl imp = new StatementBaseImpl(input, context);

            Assert.AreEqual(expected, imp.OccurenceOf <ClassToken>());
        }