Issues running MSTest tests w/ ReSharper and WCF
I'm getting an odd error when trying to run my MSTest unit tests with ReSharper's test runner at the point of calling a WCF service:
Test method MyProject.UnitTests.InvalidZipTest threw exception: System.ServiceModel.CommunicationException: There was an error in serializing body of message : 'There was an error generating the XML document.'. Please see InnerException for more details.
---> System.InvalidOperationException: There was an error generating the XML document.
---> System.InvalidCastException: [A]MyService.ZipSearch.Request cannot be cast to [B]MyService.ZipSearch.Request. Type A originates from 'MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'LoadNeither' at location 'C:\Development\MyProject.UnitTests\bin\Debug\MyProject.UnitTests.dll'. Type B originates from 'MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' in the context 'Default' at location 'C:\Users\jrose\AppData\Local\Temp\twt3nlrb.kfo\MyProject.UnitTests\assembly\dl3\2eb85aa1\83973aea_0031cc01\MyProject.DLL'.
When running the test via MSTest's test runner, the test runs fine without throwing this exception.
When running a test via ReSharper's test runner that does not involve this WCF call, the test runs fine.
A coworker also experiences these same issues.
I'm running ReSharper 5.1.1766.4, and Visual Studio 2010 v. 10.0.40219.1 SP1Rel.
I believe this is all the relevant info I can think of, but if there's anything else that I'm not think开发者_C百科ing of that may help, just let me know.
Thanks in advance.
it looks like some issues between the versions of dlls between the test project and the service.
How does your test reference the service? Is it via direct reference to the dll & config or is it via Add Service Reference?
As a start, in the options in resharper try enabling/disabling shadow copy when running the tests (I think disabling)
精彩评论