Пример #1
0
        public void Serialize()
        {
            var statement = new AssignStatement("a", SqlExpression.Constant(SqlObject.Bit(true)));
            var result    = BinarySerializeUtil.Serialize(statement);

            Assert.NotNull(result);
            Assert.NotNull(result.Variable);
            Assert.NotNull(result.Value);
        }
Пример #2
0
        public void GetMetadata()
        {
            var assign           = new AssignStatement("a", SqlExpression.Constant(SqlObject.Bit(true)));
            var statementContext = new StatementContext(context, assign);

            var meta = (statementContext as IEventSource).Metadata.ToDictionary(x => x.Key, y => y.Value);

            Assert.NotNull(meta);
            Assert.NotEmpty(meta);
            Assert.True(meta.ContainsKey("statement.var"));
            Assert.True(meta.ContainsKey("statement.value"));
        }
Пример #3
0
        public async void AssignNewWariable()
        {
            var assign = new AssignStatement("a", SqlExpression.Constant(SqlObject.Bit(true)));

            var statement = assign.Prepare(context);
            var result    = await statement.ExecuteAsync(context);

            Assert.NotNull(result);
            Assert.IsType <StatementExpressionResult>(result);

            var variable = context.ResolveVariable("a");

            Assert.NotNull(variable);
            Assert.Equal("a", variable.Name);
            Assert.IsType <SqlConstantExpression>(variable.Value);
        }
        public void Serialize()
        {
            var exp = SqlExpression.Function(ObjectName.Parse("sys.func2"),
                                             new[] { new InvokeArgument(SqlExpression.Constant(SqlObject.Bit(false))) });

            var result = BinarySerializeUtil.Serialize(exp);

            Assert.Equal(exp.FunctionName, result.FunctionName);
            Assert.Equal(exp.Arguments.Length, result.Arguments.Length);
        }
        public void CreateNew()
        {
            var exp = SqlExpression.Function(ObjectName.Parse("sys.func2"),
                                             new[] { new InvokeArgument(SqlExpression.Constant(SqlObject.Bit(false))) });

            Assert.Equal(SqlExpressionType.Function, exp.ExpressionType);
            Assert.NotNull(exp.Arguments);
            Assert.NotEmpty(exp.Arguments);
            Assert.Equal(1, exp.Arguments.Length);
        }
Пример #6
0
        public void GetString()
        {
            var statement = new AssignStatement("a", SqlExpression.Constant(SqlObject.Bit(true)));

            Assert.Equal("a := 1;", statement.ToString());
        }