【问题标题】:testing asynchronous callbacks with Rhino Mocks使用 Rhino Mocks 测试异步回调
【发布时间】:2011-04-17 15:59:41
【问题描述】:

这是我想要做的:

我有一个类 A 和一个接口 B。A 调用 B 来更新 A 的属性 someProperty。

interface B
{
    IAsyncResult BeginSetProperty(string str, AsyncCallback callback); 
    bool EndSetProperty(IAsyncResult result);
}

A 使用 b.BeginSetProperty(str, someCallback) 调用 B,其中 someCallback 调用 SomeProperty = b.EndSetProperty(result)

我如何存根 B 以便设置 someProperty?

【问题讨论】:

    标签: c# unit-testing rhino-mocks


    【解决方案1】:

    您可以查看following blog post

    【讨论】:

      猜你喜欢
      • 2023-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多