BizUnit 4.0 - 从表中删除行
我正在升级到 BizUnit 4.0 并移植设置步骤 DatabaseDeleteStep。显然在 4.0 中没有数据库删除步骤。所以我将 DbQueryStep 与 RawSqlString 一起使用。问题是它失败的原因
BizUnit.TestStepExecutionException: BizUnit encountered an error executing a test step ---> System.IndexOutOfRangeException: Cannot find table 0.
很明显,因为原始 sql
DELETE FROM [AnnuitiesDB].[Staging].[CommonwealthAgents]
不会返回任何表。
BizUnit 4.0中是否有相当于DatabaseDeleteStep的步骤?
我的代码:
var cleanDB = new DbQueryStep();
cleanDB.ConnectionString =
"Data Source=(local);Initial Catalog=AnnuitiesDB;Integrated Security=SSPI;";
cleanDB.NumberOfRowsExpected = 0;
cleanDB.SQLQuery = new SqlQuery { RawSqlQuery = "DELETE FROM [Staging].[CommonwealthAgents] where (CwAAgentId='1ead5c1ab65b677f013338baa2e6636fb1c59581' or CwAAgentId='965500bfdb81b2f4595e50cac3078871c5fc4126')" };
testCase.SetupSteps.Add(cleanDB);
谢谢,
I am upgrading to BizUnit 4.0 and porting the setup step DatabaseDeleteStep. Apparently in 4.0 there is no db delete step. So I used the DbQueryStep with RawSqlString. The problem is that its failing with this reason
BizUnit.TestStepExecutionException: BizUnit encountered an error executing a test step ---> System.IndexOutOfRangeException: Cannot find table 0.
which is obvious because the raw sql
DELETE FROM [AnnuitiesDB].[Staging].[CommonwealthAgents]
will not return any tables.
Is there a step equivalent to DatabaseDeleteStep in BizUnit 4.0?
My Code:
var cleanDB = new DbQueryStep();
cleanDB.ConnectionString =
"Data Source=(local);Initial Catalog=AnnuitiesDB;Integrated Security=SSPI;";
cleanDB.NumberOfRowsExpected = 0;
cleanDB.SQLQuery = new SqlQuery { RawSqlQuery = "DELETE FROM [Staging].[CommonwealthAgents] where (CwAAgentId='1ead5c1ab65b677f013338baa2e6636fb1c59581' or CwAAgentId='965500bfdb81b2f4595e50cac3078871c5fc4126')" };
testCase.SetupSteps.Add(cleanDB);
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以补充原始 SQL,以便返回一些内容。
You could supplement the raw SQL so that something is returned.