简体   繁体   English

通过.Net中的装置调用应用程序功能

[英]calling application functions via fixtures in .Net

I am trying to write fit tests for my SUT. 我正在尝试为我的SUT编写合适的测试。 I would like to call stored procs to create data in DB etc before I run the tests. 在运行测试之前,我想调用存储的proc在DB等中创建数据。 Could anyone please post sample code on how to call application functions via fixtures and connect to DB and call stored procs in .Net. 任何人都可以发布示例代码,说明如何通过固定装置调用应用程序函数并连接到DB并调用.Net中存储的proc。 And should fit tests reside in the Same Solution as the Application. 并且适合测试应位于与应用程序相同的解决方案中。 Or it could be in a different solution ? 还是可以采用其他解决方案?

Your question is very general and in fact is several questions. 您的问题很笼统,实际上是几个问题。 Look at the following links and see if you can get your tests written. 查看以下链接,看看是否可以编写测试。 If you have problems, post specific questions with examples of what you tried and what results you got. 如果您有问题,请发布具体问题,并附上您尝试过的方法和获得的结果的示例。

Check out DbFit for calling stored procedures: https://fitsharp.github.io/DbFit.html and http://dbfit.github.io/dbfit/docs/reference.html#execute-procedure 检出DbFit调用存储过程: https : //fitsharp.github.io/DbFit.htmlhttp://dbfit.github.io/dbfit/docs/reference.html#execute-procedure

Here's how to call application functions directly from a test: https://fitsharp.github.io/Fit/MethodExecution.html 这是直接从测试中调用应用程序函数的方法: https : //fitsharp.github.io/Fit/MethodExecution.html

You can find lots of sample code here https://github.com/jediwhale/fitsharp/tree/master/source just look at all the classes starting with "Sample" 您可以在这里找到许多示例代码https://github.com/jediwhale/fitsharp/tree/master/source,只需查看所有以“示例”开头的类

Usually I put Fit test code in the same solution as the application but you could use a separate solution too. 通常,我将Fit测试代码放在与应用程序相同的解决方案中,但是您也可以使用单独的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM