Exemplo n.º 1
0
        public void Validate_WhenNodeIsSqlTable_DoesNotThrowException()
        {
            var validator = new SqlAstValidator();

            var node = new SqlTable(null, null, null, null, null, null, false);

            Action action = () => validator.Validate(node);

            action.Should().NotThrow();
        }
Exemplo n.º 2
0
        public void Validate_WhenNodeIsNull_ThrowsException()
        {
            var validator = new SqlAstValidator();

            Action action = () => validator.Validate(null);

            action.Should()
            .Throw <ArgumentNullException>()
            .Which.ParamName.Should()
            .Be("node");
        }
Exemplo n.º 3
0
        public void Validate_WhenNodeNotIsSqlTable_ThrowsException()
        {
            var validator = new SqlAstValidator();

            var node = new SqlNoop();

            Action action = () => validator.Validate(node);

            action.Should()
            .Throw <JoinMonsterException>()
            .Which.Message.Should()
            .Be($"Expected node to be of type '{typeof(SqlTable)}' but was '{typeof(SqlNoop)}'.");
        }
Exemplo n.º 4
0
        public void Validate_WhenNodeIsSqlTableWithAJoin_ThrowsException()
        {
            var validator = new SqlAstValidator();

            var node = new SqlTable(null, null, null, null, null, null, false)
            {
                Join = (join, arguments, context, sqlAstNode) => {}
            };

            Action action = () => validator.Validate(node);

            action.Should()
            .Throw <JoinMonsterException>()
            .Which.Message.Should()
            .Be("Root level field cannot have 'SqlJoin'.");
        }