与测试数据库集成测试链式 WCF 服务
寻找有关如何继续此处的一些建议。
我正在尝试对调用其他 wcf 服务的 wcf 服务进行一些集成测试。我想确保它们之间的配置正确。我们目前使用 spring.net 和 Nhibernate。我不确定如何检查数据库是否正在更新,而不实际将任何内容保存到数据库中。
我有 msmq 和 wshttp 服务,我想在这里测试它们。我熟悉事务,因为我们在春季使用它们,但我不知道如何设置我的测试来回滚未通过集成测试直接测试的服务中的事务。
现在我想到的唯一选择是使用测试数据库和测试数据,但似乎必须有比这更好的解决方案。
Looking for some advice on how to proceed here.
I am trying to do some integration testing on wcf services that call other wcf services. I want to make sure that they are configured correctly between one another. We are currently using spring.net and Nhibernate. What I am not sure about is how to check that the database is getting updated without actually saving anything to the database.
I have both msmq and wshttp services that I am trying to test here. I am familiar with transactions, as we use them in spring, but I have no idea how to setup my tests to rollback the transaction in a service that is not being tested directly by the integration test.
Right now the only option I have come up with is using a test database and test data, but it seems like there has to be a better solution than this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您可以使用 Moq 之类的内容来模拟更新数据库(或 DAL 层)的服务,避免调用数据库并使用mock的verify方法检查是否将执行对数据库的调用。在我们的项目中,我们将此库与 wcf 一起使用,效果非常好。
Perhaps you can mock the services that update the database (or the DAL layer) using something like Moq, avoid the call to the database and checking with the verify method of the mock that the call to the database will be performed. In our project we are using this library with wcf with very good results.
我决定采用特定于应用程序的实现。基本上创建一个测试数据库,并让我们的应用程序根据传递到我们服务中的一些值来访问测试数据库。
I decided to go with an implementation that is application specific. Basically creating a test database, and having our application hit the test database based on some values that are passed into our service.