I converted the solution from VS2008 to VS2010 SP1 and modified the unit test project to set up a 3.5 framework. Besides the need to fix several links in the unit test project, everything worked fine, and the solution was successfully built. Most tests performed successfully, but there were several unsuccessful ones. Those that failed use a private accessor. Personally, I would rather just delete these tests, since I do not think they are necessary, but while he finds a potential error in SP1, I thought that I would see if anyone could figure out the work.
The error message that I get when running the tests is "This assembly is built using the runtime that is newer than the current loaded runtime and cannot be loaded." As far as I can tell, it seems that the private assembly of accessories is built using the runtime 4.0 (most likely using Microsoft.VisualStudio.QualityTools.UnitTestFramework), but since the runtime 3.5 loads MSTest, an error occurs.
I tried changing the link for Microsoft.VisualStudio.QualityTools.UnitTestFramework to specifically use version 9.0 (currently 10.1). This results in a compile-time error, which states that the private access assembly uses version 10.0 of Microsoft.VisualStudio.QualityTools.UnitTestFramework, which is higher than version 9.0.
I deleted the created private assembly of accessories and recreated it, and still have the same problem. It would seem that something is not synchronizing with VS2010 SP1 when the 3.5 framework is aimed at the unit test project.
Here is the code for one of the unit tests (again, not a very valuable test, but this is not the point of the message ...):
[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);
}
source
share