views:

417

answers:

2

I have a visual studio 2008 Unit test and I'm getting the following runtime error:

Unable to set TestContext property for the class JMPS.PlannerSuite.DataServices.MyUnitTest.  Error:  System.ArgumentException:  Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'

I have read that VS 2008 does not properly update the references to the UnitTestFramework when converting 2005 projects. My unit test was created in 2008 but it inherits from a base class built in VS 2005. Is this where my problem is coming from? Does my base class have to be rebuilt in 2008? I would rather not do this as it will affect other projects.

In other derived unit tests built in 2005, all that we needed to do was comment out the TestContext property in the derived unit test. I have tried this in the VS 2008 unit test with no luck. I have also tried to "new" the TestContext property which gives me a different runtime error.

Any ideas?

A: 

i use "nunit" for all my testing. you could try to run your tests in there.

see_sharp_guy
A: 

I ran into the same issue. Turned out that one of my projects was referencing the 8.0 assemblies and the other was referencing 9.0. The solution compiled, but I got a runtime exception.

jcollum