NBehave 在 resharper 中输出故事

发布于 2024-07-13 11:30:33 字数 424 浏览 4 评论 0 原文

我用 NBehave 写了很多故事。

现在我已经看到了输出以人类容易理解的格式显示的示例 (查看此示例)Wayback machine link

有没有办法在 resharper 中获取此输出?

I wrote a bunch of stories using NBehave.

Now I have seen examples where the output is display in human readily format (see this example)Wayback machine link

Is there any way to get this output in resharper?

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

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

发布评论

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

评论(1

溇涏 2024-07-20 11:30:33

发布者Jörg Jenni 在他的博客上。 他展示了如何显示 nBehave 输出:

使用最新版本的 NBehave 0.4 时,您可能会注意到
不再有输出写入 ReSharper Testrunner 输出。

这是我解决该问题的方法。 我从以下来源获得了规格
下课后一切都恢复正常了:

公共类 SpecBaseWithConsoleOutput:SpecBase 
  { 
    私有EventHandler>   添加了处理程序; 
    私有EventHandler>   场景创建处理程序;    
    私有EventHandler>   故事创建处理程序; 
    公共重写 void MainSetup() 
    { 
      基.MainSetup(); 
      添加处理程序 = (o, a) =>   Console.WriteLine(a.EventData.Message); 
      sceneCreatedHandler = (o, a) =>;   Console.WriteLine(a.EventData.Title); 
      StoryCreatedHandler = (o, a) =>;   Console.WriteLine(a.EventData.Title); 
      Story.MessageAdded += addedHandler; 
      Story.ScenarioCreated += sceneCreatedHandler; 
      Story.StoryCreated += StoryCreatedHandler; 
    } 
    公共重写 void MainTeardown() 
    { 
      Story.MessageAdded -= addHandler; 
      Story.ScenarioCreated -= sceneCreatedHandler; 
      Story.StoryCreated -=storyCreatedHandler; 
      基.MainTeardown(); 
    } 
  } 
  

This was posted by Jörg Jenni on his blog. He shows how to get nBehave output to display:

When working with the latest build of NBehave 0.4 you may notice that
there is no output written to the ReSharper Testrunner Output anymore.

Here is how I did workaround the problem. I derived the specs from the
following class and every thing was fine again:

public class SpecBaseWithConsoleOutput: SpecBase
{
  private EventHandler<EventArgs<MessageEventData>> addedHandler;
  private EventHandler<EventArgs<Scenario>> scenarioCreatedHandler;   
  private EventHandler<EventArgs<Story>> storyCreatedHandler;
  public override void MainSetup()
  {
    base.MainSetup();
    addedHandler = (o, a) => Console.WriteLine(a.EventData.Message);
    scenarioCreatedHandler = (o, a) => Console.WriteLine(a.EventData.Title);
    storyCreatedHandler = (o, a) => Console.WriteLine(a.EventData.Title);
    Story.MessageAdded += addedHandler;
    Story.ScenarioCreated += scenarioCreatedHandler;
    Story.StoryCreated += storyCreatedHandler;
  }
  public override void MainTeardown()
  {
    Story.MessageAdded -= addedHandler;
    Story.ScenarioCreated -= scenarioCreatedHandler;
    Story.StoryCreated -= storyCreatedHandler;
    base.MainTeardown();
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文