Using Visual Studio 2010 SP1 and ReSharper 6.1, we're having trouble with some of our unit tests. If the test class has a [ClassInitialize] attribute on it, we get this error:
Method ClassInit has wrong signature. Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.
Secondly, if the test uses [ExpectedException], ReSharper fails the test.
Are there any solutions to these issues? Any suggestions are appreciated.
I found this posting on Microsoft's connect website:
I tried the suggested workaround of removing the ProjectTypeGuid and that worked. When I open the project again, it keeps the UnitTestFramework version of 10.0 and doesn't try replacing it with 10.1.
Why does 10.0 work but not 10.1? Very strange.
This blog posting was very helpful in understanding how to get my unit tests to work within mstest, but I still don't know how to get them to work with Refactor. I'm currently getting the following error when I try to run any of my tests
I am also experiencing the problems outlined in the original post running R# 6.1 on VS2010SP1. To give some background we recently upgraded to VS2010 SP1 from VS2008 SP1 but we are not yet ready for .NET 4.0 so we retargeted all projects to .NET 3.5.
All of the tests successfully execute and pass when using the Microsoft test runner. If I select the "Run tests with MSTest.exe (not recommended)" R# setting when I run all tests the R# test runner appears with all of the loaded test names but they all stay as "Pending" and never execute.
The work arounds are fairly destructive, VS2010 SP1 supports retargeting unit test projects, but there appears to be some issues with R# 6.x.
Any other insight on this?
I am not really keen on performing some arbitraty hacks to our solutions and referencing strange version of assemblies that may or may not be appropriate in our context. We have a rather large codebase and manually hacking at the project files and references for the sake of the R# test runner is not something we are comfortable with. We are willing to make due with the microsoft test runner for the time being if we could be assured that this was indeed a R# issue and that it would be addressed in a future release?
Thanks for your feedback.