如何使用 Rhino Mocks 模拟任意行为?

发布于 2024-09-17 11:47:18 字数 290 浏览 3 评论 0原文

我正在尝试模拟数据层方法。该方法采用一个字符串和两个列表作为参数,并且该方法从存储过程的结果填充这些列表。另外,我仍在使用 C# 2.0 和 VS2005,并且我正在使用 Rhino Mocks 3.5 for .NET 2.0。如果可能的话,最好使用 AAA 格式。

所以是的,我想做的就是模拟一个接口方法,它将向参数列表添加几个假对象并返回。不幸的是,在阅读了 Rhino Mocks 文档后,我几乎不知道如何做到这一点。 Rhino 对我来说是一个难以理解的拼图盒,没有例子我就无能为力;我找不到的例子。

有人知道我该怎么做吗?

I'm trying to mock a data layer method. The method takes a string and two lists as arguments, and the method populates those lists from the results of a stored proc. Also, I'm still on C# 2.0 with VS2005, and I'm using Rhino Mocks 3.5 for .NET 2.0. If possible, it would be nice to use the AAA format.

So yeah, all I want to do is mock an interface method that will add a couple of fake objects to the argument lists and return. Unfortunately, after reading the Rhino Mocks documentation, I have little to no idea how to do this. Rhino is a unintelligible puzzle box to me and I'm powerless to do anything without examples; examples that I can't find.

Anyone have any idea how I can do this?

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

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

发布评论

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

评论(1

帅气尐潴 2024-09-24 11:47:18

您可以在 .NET 2.0 中使用 AAA 语法,只是需要多输入一些内容。请参阅在 C# 2.0 中使用 AAA 语法

You can use the AAA syntax with .NET 2.0, it's just a little bit more typing. See Using the AAA syntax in C# 2.0

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