mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
update tests
This commit is contained in:
parent
3c812d4305
commit
ede456f1bf
@ -1126,12 +1126,12 @@ WHERE (((cast(a.`Id` as char)) in (SELECT b.`Title`
|
|||||||
WF_ProcessInstance = p
|
WF_ProcessInstance = p
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.Equal(@"SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId` ProcessId, a.`NodeId` NodeId, a.`NodeName` NodeName
|
Assert.Equal(@"SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId`, a.`NodeId`, a.`NodeName`
|
||||||
FROM `WF_Task` a
|
FROM `WF_Task` a
|
||||||
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
||||||
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName`", sqltmp12);
|
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName`", sqltmp12);
|
||||||
Assert.Equal(@"SELECT a.`TaskId` as1, a.`TaskType` as2, a.`ProcessId` as3, a.`NodeId` as4, a.`NodeName` as5, b.`Id` as6, b.`TaskType` as7, b.`ProcessId` as8, b.`NodeId` as9, b.`CreateTime` as10, b.`IsFinished` as11, b.`EnabledMark` as12
|
Assert.Equal(@"SELECT a.`TaskId` as1, a.`TaskType` as2, a.`ProcessId` as3, a.`NodeId` as4, a.`NodeName` as5, b.`Id` as6, b.`TaskType` as7, b.`ProcessId` as8, b.`NodeId` as9, b.`CreateTime` as10, b.`IsFinished` as11, b.`EnabledMark` as12
|
||||||
FROM ( SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId` ProcessId, a.`NodeId` NodeId, a.`NodeName` NodeName
|
FROM ( SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId`, a.`NodeId`, a.`NodeName`
|
||||||
FROM `WF_Task` a
|
FROM `WF_Task` a
|
||||||
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
||||||
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName` ) a
|
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName` ) a
|
||||||
|
@ -1137,12 +1137,12 @@ WHERE (((cast(a.`Id` as char)) in (SELECT b.`Title`
|
|||||||
WF_ProcessInstance = p
|
WF_ProcessInstance = p
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.Equal(@"SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId` ProcessId, a.`NodeId` NodeId, a.`NodeName` NodeName
|
Assert.Equal(@"SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId`, a.`NodeId`, a.`NodeName`
|
||||||
FROM `WF_Task` a
|
FROM `WF_Task` a
|
||||||
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
||||||
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName`", sqltmp12);
|
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName`", sqltmp12);
|
||||||
Assert.Equal(@"SELECT a.`TaskId` as1, a.`TaskType` as2, a.`ProcessId` as3, a.`NodeId` as4, a.`NodeName` as5, b.`Id` as6, b.`TaskType` as7, b.`ProcessId` as8, b.`NodeId` as9, b.`CreateTime` as10, b.`IsFinished` as11, b.`EnabledMark` as12
|
Assert.Equal(@"SELECT a.`TaskId` as1, a.`TaskType` as2, a.`ProcessId` as3, a.`NodeId` as4, a.`NodeName` as5, b.`Id` as6, b.`TaskType` as7, b.`ProcessId` as8, b.`NodeId` as9, b.`CreateTime` as10, b.`IsFinished` as11, b.`EnabledMark` as12
|
||||||
FROM ( SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId` ProcessId, a.`NodeId` NodeId, a.`NodeName` NodeName
|
FROM ( SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId`, a.`NodeId`, a.`NodeName`
|
||||||
FROM `WF_Task` a
|
FROM `WF_Task` a
|
||||||
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
||||||
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName` ) a
|
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName` ) a
|
||||||
|
@ -1168,12 +1168,12 @@ WHERE (((cast(a.`Id` as char)) in (SELECT b.`Title`
|
|||||||
});
|
});
|
||||||
|
|
||||||
Assert.Equal(@"SELECT a.`Id` as1, a.`Clicks` as2
|
Assert.Equal(@"SELECT a.`Id` as1, a.`Clicks` as2
|
||||||
FROM (SELECT * from (SELECT a.`Id` Id, a.`Clicks` Clicks
|
FROM (SELECT * from (SELECT a.`Id`, a.`Clicks`
|
||||||
FROM `tb_topic_1` a) ftb
|
FROM `tb_topic_1` a) ftb
|
||||||
|
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
|
||||||
SELECT * from (SELECT a.`Id` Id, a.`Clicks` Clicks
|
SELECT * from (SELECT a.`Id`, a.`Clicks`
|
||||||
FROM `tb_topic_2` a) ftb) a
|
FROM `tb_topic_2` a) ftb) a
|
||||||
limit 0,20", select
|
limit 0,20", select
|
||||||
.AsTable((type, old) => type == typeof(Topic) ? $"({sqlsss})" : null)
|
.AsTable((type, old) => type == typeof(Topic) ? $"({sqlsss})" : null)
|
||||||
@ -1206,12 +1206,12 @@ limit 0,20", select
|
|||||||
WF_ProcessInstance = p
|
WF_ProcessInstance = p
|
||||||
});
|
});
|
||||||
|
|
||||||
Assert.Equal(@"SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId` ProcessId, a.`NodeId` NodeId, a.`NodeName` NodeName
|
Assert.Equal(@"SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId`, a.`NodeId`, a.`NodeName`
|
||||||
FROM `WF_Task` a
|
FROM `WF_Task` a
|
||||||
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
||||||
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName`", sqltmp12);
|
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName`", sqltmp12);
|
||||||
Assert.Equal(@"SELECT a.`TaskId` as1, a.`TaskType` as2, a.`ProcessId` as3, a.`NodeId` as4, a.`NodeName` as5, b.`Id` as6, b.`TaskType` as7, b.`ProcessId` as8, b.`NodeId` as9, b.`CreateTime` as10, b.`IsFinished` as11, b.`EnabledMark` as12
|
Assert.Equal(@"SELECT a.`TaskId` as1, a.`TaskType` as2, a.`ProcessId` as3, a.`NodeId` as4, a.`NodeName` as5, b.`Id` as6, b.`TaskType` as7, b.`ProcessId` as8, b.`NodeId` as9, b.`CreateTime` as10, b.`IsFinished` as11, b.`EnabledMark` as12
|
||||||
FROM ( SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId` ProcessId, a.`NodeId` NodeId, a.`NodeName` NodeName
|
FROM ( SELECT max(a.`Id`) TaskId, max(a.`Type`) TaskType, a.`ProcessId`, a.`NodeId`, a.`NodeName`
|
||||||
FROM `WF_Task` a
|
FROM `WF_Task` a
|
||||||
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
WHERE (a.`IsFinished` = 1 AND (a.`AuditorId` = '1' OR a.`AuditorId` = '1cb71584-a6dd-4b26-8c88-ed9fb8cf87a3'))
|
||||||
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName` ) a
|
GROUP BY a.`ProcessId`, a.`NodeId`, a.`NodeName` ) a
|
||||||
|
@ -32,6 +32,9 @@ namespace FreeSql.Tests.MySql
|
|||||||
Assert.Equal(t1.Columns.Count, t2.Columns.Count);
|
Assert.Equal(t1.Columns.Count, t2.Columns.Count);
|
||||||
var t3 = fsql.DbFirst.GetTableByName("notexists_tb");
|
var t3 = fsql.DbFirst.GetTableByName("notexists_tb");
|
||||||
Assert.Null(t3);
|
Assert.Null(t3);
|
||||||
|
|
||||||
|
var t11 = fsql.DbFirst.GetTableByName("blog");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
@ -909,10 +909,10 @@ FROM ""TB_TOPIC22"" a", subquery);
|
|||||||
Assert.Equal(@"SELECT a.""ID"" as1, a.""CLICKS"" as2, a.""TYPEGUID"" as3, a.""TITLE"" as4, a.""CREATETIME"" as5, (SELECT avg(b.""ID"")
|
Assert.Equal(@"SELECT a.""ID"" as1, a.""CLICKS"" as2, a.""TYPEGUID"" as3, a.""TITLE"" as4, a.""CREATETIME"" as5, (SELECT avg(b.""ID"")
|
||||||
FROM ""TB_TOPIC22"" b) as6
|
FROM ""TB_TOPIC22"" b) as6
|
||||||
FROM ""TB_TOPIC22"" a", subquery);
|
FROM ""TB_TOPIC22"" a", subquery);
|
||||||
var subqueryList = select.Limit(100).ToList(a => new
|
var subqueryList = select.Limit(10).ToList(a => new
|
||||||
{
|
{
|
||||||
all = a,
|
all = a,
|
||||||
count = select.As("b").Avg(b => b.Id)
|
count = select.As("b").Limit(10).Avg(b => b.Id)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
[Fact]
|
[Fact]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user