示例#1
0
 public void set_fields()
 {
     _writer.SetColumnsResults("SomeId");
     _writer.SetSqlResults("Id=@1");
     _sut.Set(d => d.SomeId, 34).Where(d => d.Id == Guid.Empty).Execute();
     _executor.Result.SqlText.Should().Be("update SomePost set SomeId=@0 where Id=@1");
     Parameter(0).Should().Be(34);
 }
示例#2
0
        public void simple_query()
        {
            _writer.SetColumnsResults("grp", "sort", "*");
            _writer.SetSqlResults("c1", "c2", "c3", "h1");
            var sql = Where.Where(d => d.SomeId == 2)
                      .And(d => d.Title == "")
                      .Or(d => d.Title == "")
                      .GroupBy(d => d.SomeId)
                      .Having(d => d.SomeId == 1)
                      .OrderBy(d => d.SomeId)
                      .Limit(2)
                      .SelectAll()
                      .GetCommandConfiguration();

            sql.SqlText.Should()
            .Be(@"select  SomeId, Id, Title, Author, Email, CreatedOn from SomePost
where c1
and c2
or c3
group by grp
having h1
order by sort
 limit");
        }