I converted a solution from VS2008 to VS2010 SP1, and changed the unit test project to target the 3.5 framework. Other than having to fix a few references in the unit test project, everything worked ok and the solution built successfully. Most of the tests run successfully, but there were a handful that failed. The ones that failed are using a private accessor. Personally, I'd rather just remove these tests since I don't think they're necessary, but as long as it reveals a potential bug in SP1, I thought I'd see if anyone could figure out a work-around.
The error message that I receive when running the tests is "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." As best as I can tell, it appears that the private accessor assembly is being built by the 4.0 runtime (most likely via Microsoft.VisualStudio.QualityTools.UnitTestFramework), but since the 3.5 runtime is loaded by MSTest, the resulting error occurs.
I tried changing the reference for Microsoft.VisualStudio.QualityTools.UnitTestFramework to specifically use version 9.0 (currently it is 10.1). This results in a compile time error which says that the private accessor assembly uses version 10.0 of Microsoft.VisualStudio.QualityTools.UnitTestFramework, which is higher than version 9.0.
I've deleted the generated private accessor assembly and recreated it as well, and still have the same issue. It would seem that something is out of sync with VS2010 SP1 when the 3.5 framework is targeted in a unit test project.
Here is the code for one of the unit tests (again, not a very valuable test, but that's not the point of the post...):
[TestMethod()]
public void GetNullableCharValue_DBNull_ReturnsNull_Test()
{
object value = DBNull.Value;
Nullable<char> expected = null;
Nullable<char> actual;
actual = RepositoryBase_Accessor.GetNullableCharValue(value);
Assert.AreEqual(expected, actual);
}