public void FluentResolverShouldCallMatchExpressionwhenCanResolving()
        {
            IList <TokenBase> input = new List <TokenBase>();

            input.Add(TokenCreator.Create <GenericToken>("source", null));
            input.Add(TokenCreator.Create <GenericToken>("code", null));
            input.Add(TokenCreator.Create <SemiColonToken>());

            FluentStatementFactoryImpl factory = new FluentStatementFactoryImpl(true);

            factory.CanCreateStatementFrom(input, null);

            Assert.True(factory.MatchExpressionWasCalled);
        }
        public void FluentResolverShouldThrowExceptionOnRequestingResolveWhenCannotResolve()
        {
            IList <TokenBase> input = new List <TokenBase>();

            input.Add(TokenCreator.Create <GenericToken>("source", null));
            input.Add(TokenCreator.Create <GenericToken>("code", null));
            input.Add(TokenCreator.Create <SemiColonToken>());

            FluentStatementFactoryImpl factory = new FluentStatementFactoryImpl(false);

            Assert.AreEqual(false, factory.CanCreateStatementFrom(input, null));
            Assert.Throws <CalidusException>(delegate
            {
                factory.Create(input, null);
            }, "The factory cannot parse the token list into a statement");
        }