示例#1
0
        public void TestIn_4()
        {
            //结果
            var result = new String();

            result.Append("Where [user].[Email] In (");
            result.AppendLine("Select [a] ");
            result.Append("From [b]");
            result.Append(")");

            //执行
            var builder = _builder.New().Select("a").From("b");

            _clause.In("user.Email", builder);

            //验证
            Assert.Equal(result.ToString(), GetSql());
        }
示例#2
0
        public void Test_38()
        {
            //结果
            var result = new String();

            result.AppendLine("Select * ");
            result.AppendLine("From [Test] ");
            result.Append("Where [Age]=@_p_1 And [Name]=@_p_0");

            //执行
            var newBuilder = _builder.New().Where("Name", "a");

            _builder.From("Test").Where("Age", 1).And(newBuilder);

            //验证
            Assert.Equal(result.ToString(), _builder.ToSql());
            Assert.Equal(2, _builder.GetParams().Count);
            Assert.Equal("a", _builder.GetParams()["@_p_0"]);
            Assert.Equal(1, _builder.GetParams()["@_p_1"]);
        }