I've written some MSpecs, but Visual Studio (2015) test runner does not recognize them. I've added the Machine.Specifications.Runner.Console
and all required Machine.Specification
-packages using the NuGet-PM. But when I choose Test->Run Test
, the mspec-containing file is not even listed.
Beyond is an example of the mspecs I wrote so far, which is located in an own project/solution that contains some other (regular unit) test, which all run fine btw.
[Subject(typeOf(ControllerForm)]
public class When_file_with_multiple_procedures_is_opened:ControllerFormSpecs
{
static ControllerForm subject;
...
Establish context =()=>
{
subject = new ControllerForm(...);
path="someRandomPath";
};
Because of =()=>
{
subject.OpenFile(path);
}
It should_have_event =()=> subject.eventExist.ShouldBeTrue();
It should_not_have_data =()=> subject.currentNode.ShouldBeNull();
Cleanup after =()=>
{
subject = null;
};
}
What am I missing?
Note: Using ReSharper is not an option here. I know many people like it and even more recommend it, but my company allready declined my request for that.
edit: Using the 'Machine.Specifications.Console.Runner' you got to keep the following in mind:
1) Change the working directory of the console to the very one, where all mespc.exe files are stored (in my case: c:\projects\...\Source\packages\Machine.Specifications.Runner.Console.versionnumber\tools
)
2) Choose the right .exe-file depending on your debug-options (in my case: mspec-x86.exe
)
3) as parameter you now have to insert the relative path to the .dll of the very project that contains the mspecs. ( again as example for my case:
..\..\..\PluginTests\bin\x86\Debug\PluginTests.dll
The console runner is for running specs from the command line. You need the Visual Studio MSTest runner installed.