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 输出中。诶?显然我做的不对,请赐教!