add min/max DateTime IsNull Tests #1140

This commit is contained in:
2881099
2022-06-02 22:02:16 +08:00
parent f3b79bf2a6
commit 8263379720
18 changed files with 233 additions and 112 deletions

View File

@ -844,15 +844,18 @@ FROM [tb_topic22] a", subquery);
var subquery = select.ToSql(a => new
{
all = a,
count = select.As("b").Min(b => b.Id)
min = select.As("b").Min(b => b.Id),
min2 = select.As("b").Min(b => b.CreateTime)
});
Assert.Equal(@"SELECT a.[Id] as1, a.[Clicks] as2, a.[TypeGuid] as3, a.[Title] as4, a.[CreateTime] as5, isnull((SELECT min(b.[Id])
FROM [tb_topic22] b), 0) as6
FROM [tb_topic22] b), 0) as6, isnull((SELECT min(b.[CreateTime])
FROM [tb_topic22] b), '1970-01-01 00:00:00.000') as7
FROM [tb_topic22] a", subquery);
var subqueryList = select.ToList(a => new
{
all = a,
count = select.As("b").Min(b => b.Id)
min = select.As("b").Min(b => b.Id),
min2 = select.As("b").Min(b => b.CreateTime)
});
}
[Fact]
@ -861,15 +864,18 @@ FROM [tb_topic22] a", subquery);
var subquery = select.ToSql(a => new
{
all = a,
count = select.As("b").Max(b => b.Id)
max = select.As("b").Max(b => b.Id),
max2 = select.As("b").Max(b => b.CreateTime)
});
Assert.Equal(@"SELECT a.[Id] as1, a.[Clicks] as2, a.[TypeGuid] as3, a.[Title] as4, a.[CreateTime] as5, isnull((SELECT max(b.[Id])
FROM [tb_topic22] b), 0) as6
FROM [tb_topic22] b), 0) as6, isnull((SELECT max(b.[CreateTime])
FROM [tb_topic22] b), '1970-01-01 00:00:00.000') as7
FROM [tb_topic22] a", subquery);
var subqueryList = select.ToList(a => new
{
all = a,
count = select.As("b").Max(b => b.Id)
max = select.As("b").Max(b => b.Id),
max2 = select.As("b").Max(b => b.CreateTime)
});
}
[Fact]