Unable to set TestContext property

Posted by Brandon on Stack Overflow See other posts from Stack Overflow or by Brandon
Published on 2009-06-17T12:29:42Z Indexed on 2010/04/09 18:23 UTC
Read the original article Hit count: 1212

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about c#

Related posts about unit-testing