Testing the device in VS2010

Recently, my company updated our project to VS2010 from VS2008. One of the troubling issues is our unit tests. In VS 2008, most unit tests have this piece of code public TestContext TestContext { get; set; }in VS2008, there were no problems with this, but with VS2010 I now get the following errors:

Cannot set the TestContext property for the VisitorTestAdapterTest class. Error: System.ArgumentException: object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'

If I just comment on this, then the test work is fine, but looked at the reason it was caused. Does anyone know what has changed as part of unit tests?

+5
source share
1 answer

Make sure the correct type is specified TestContext. For VS2010 it is mentioned Microsoft.VisualStudio.TestTools.UnitTesting.TestContext. In this way:

  • make sure device tests have the correct using-stat:

    using Microsoft.VisualStudio.TestTools.UnitTesting;
    
  • make sure your test version references the correct library

  • If your tests are not used TestContext, you can completely remove it.
+4
source

All Articles