如何使用RhinoMocks测试异步WCF服务调用

发布于 2024-10-01 19:01:08 字数 369 浏览 2 评论 0原文

我们有一个 Silverlight 4 应用程序,它对 WCF 服务进行标准异步调用以从数据库获取数据。我们有这个 IDataService 的接口,因此我们可以模拟它。我一直在阅读有关 RhinoMocks 的内容,并试图了解如何为此编写测试。我想我需要测试是否进行了调用来获取数据(类似于 GetCustomers),然后使用数据调用了 GetCustomersCompleted 方法。我今天看到了很多不同的例子,以及发起事件的旧方式与新方式(我也不知道)。有谁有使用 RhinoMocks 进行此类测试的简单示例吗?如果将 TDD 和 RhinoMocks 与 Silverlight 结合使用,这似乎是一件很常见的事情。任何示例或链接将不胜感激。经过几天的探索后,我非常乐意在这方面获得任何帮助。 提前致谢! 账单

We have a Silverlight 4 app that is making the standard async call to a WCF service to get data from the database. We have an interface for this IDataService so we can mock it out. I've been reading about RhinoMocks and trying to understand how to write a test for this. I think I would need to test that the call was made to get the data (something like GetCustomers) and then that the GetCustomersCompleted method was called with the data. I've seen so many different examples today and the old way to raise an event vs the new way (and I didn't know either). Does anyone have a simple example of using RhinoMocks for this kind of test? It seems like it would be something very common if one is using TDD and RhinoMocks with Silverlight. Any examples or links would be greatly appreciated. After several days of exploring I'd be great full for any help in this area.
thanks in advance!
Bill

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独﹏钓一江月 2024-10-08 19:01:08

我一直在努力尝试为 WPF 应用程序编写一些异步测试,直到找到以下博客条目:

http://blog.tatham.oddie.com.au/2009/04/09/testing-the-world -and-writing-better-quality-code-along-the-way/

我相信它也应该适用于 Silverlight 版本的 Rhino Mocks。

I was struggling trying to write some async tests for a WPF app until I found the following blog entry:

http://blog.tatham.oddie.com.au/2009/04/09/testing-the-world-and-writing-better-quality-code-along-the-way/

I believe it should work for the Silverlight version of Rhino Mocks as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文