为什么这个注释掉的 MSpec Behaviour 会出现在 ReSharper 测试运行程序中?
MSpec 大师,为什么这不起作用?
public class with_command_line_args {
protected const string ValidFilename = "ValidFilename.txt";
protected const string InvalidFilename = "Invalid:Filename";
protected static string[] Args;
protected static Exception Exception;
}
[Behaviors]
public class InvalidCommandlineArgsBehaviours
{
protected static Exception Exception;
It should_throw= () => Exception.ShouldNotBeNull();
//It should_not_store_any_filename;
}
[Subject(typeof(Program), "Invalid command line parameter")]
public class when_invoked_with_no_parameters : with_command_line_args
{
Establish context = () => Args = new string[] {};
Because of = () => Exception = Catch.Exception(() => Program.ProcessCommandLineArgs(Args));
Behaves_like<InvalidCommandlineArgsBehaviours> invalid_args;
}
当我在 ReSharper 中运行它时,规范显示但不执行(我也无法调试它):
奇怪的是,注释掉的规范出现在 ReSharper 输出中。呃?显然我做的不对,请赐教!
MSpec gurus, why doesn't this work?
public class with_command_line_args {
protected const string ValidFilename = "ValidFilename.txt";
protected const string InvalidFilename = "Invalid:Filename";
protected static string[] Args;
protected static Exception Exception;
}
[Behaviors]
public class InvalidCommandlineArgsBehaviours
{
protected static Exception Exception;
It should_throw= () => Exception.ShouldNotBeNull();
//It should_not_store_any_filename;
}
[Subject(typeof(Program), "Invalid command line parameter")]
public class when_invoked_with_no_parameters : with_command_line_args
{
Establish context = () => Args = new string[] {};
Because of = () => Exception = Catch.Exception(() => Program.ProcessCommandLineArgs(Args));
Behaves_like<InvalidCommandlineArgsBehaviours> invalid_args;
}
When i run this in ReSharper, the specification shows up but doesn't execute (I can't debug it either):
Curiously, the commented-out specification shows up in the ReSharper output. Eh? Clearly I'm not doing something right, please enlighten me!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
啊,这肯定是 ReSharper 的一个奇怪的事情。从 Visual Studio 退出并重新运行上下文后,它按预期工作。
Ah, this must have been a wierd ReSharper thing. After quitting from Visual Studio and re-running the context, it works as expected.
这对我来说是一个持续存在的问题。有时重新启动 Visual Studio 可以解决该问题。有时会重命名行为。有时只需注释掉行为中的测试,然后一一重新启用它们!
我尝试升级 Machine.Specifications ReSharper 插件但无济于事。
现在,无论我尝试什么,我都无法在 R# 测试运行程序中可靠地运行一种行为...
我真的很感谢提供的任何帮助!
ReSharper 6.1.1000.82
机器规格0.5.6
视觉工作室2010
This is a constant problem for me. Sometimes restarting Visual Studio resolves it. Sometimes renaming the behaviour. Sometimes just commenting out the tests in the behaviour and then re-enabling them one by one!
I've tried upgrading the Machine.Specifications ReSharper plug-in to no avail.
Right now I have one behaviour that I can't get to reliably run in the R# test runner no matter what I try...
I'd really appreciate any help offered!
ReSharper 6.1.1000.82
Machine.Specifications 0.5.6
Visual Studio 2010