Tim Long
Tim Long

Reputation: 13778

Why does this commented out MSpec Behavior show up in the ReSharper test runner?

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):
ReSharper Unit Test Runner output
Curiously, the commented-out specification shows up in the ReSharper output. Eh? Clearly I'm not doing something right, please enlighten me!

Upvotes: 0

Views: 173

Answers (2)

Jason Duffett
Jason Duffett

Reputation: 3458

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

Upvotes: 0

Tim Long
Tim Long

Reputation: 13778

Ah, this must have been a wierd ReSharper thing. After quitting from Visual Studio and re-running the context, it works as expected. ReSharper test Runner output

Upvotes: 1

Related Questions