I want the same unit tests to run on both the desktop & the device. Is there any recommended means of accomplishing this? Getting started I just use two projects referencing the same files:
|_ SharedUnitTest1.cs (same file / linked)
In the test list the @storage attribute for the test can only point to one of these. Any use of TestContext (ClassInitialize, etc.) causes the following, somewhat expected, error:
Unable to set TestContext property for the class [...]: System.ArgumentException: Object of type 'Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapterContext' cannot be converted to type 'Microsoft.VisualStudio.TestTools.UnitTesting.TestContext'Friday, February 13, 2009 6:07 PM
After adjusting the two .csproj files so that they switch between Microsoft.VisualStudio.QualityTools.UnitTestFramework and Microsoft.VisualStudio.SmartDevice.UnitTestFramework depending on active configuration, the correct TestContext is usable.
However, when trying to use an accessor, I get the following errors:
error CS0012: The type 'Microsoft.VisualStudio.TestTools.UnitTesting.BaseShadow' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.VisualStudio.SmartDevice.UnitTestFramework, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
error CS0012: The type 'Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.VisualStudio.SmartDevice.UnitTestFramework, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Adding a reference to both the desktop + device unit testing assemblies causes the build to fail because so many types are duplicated between them. I have no idea where to begin looking at what happens to the <Shadow/> element nor how the BuildShadowTask knows to switch between device and desktop.Friday, February 13, 2009 8:16 PM
Can you give more instructions as to how this was resolved. I do not have an .accessor file.
I want to achieve the same goal have a single set of unit tests that can be executed on both desktop and device. I do not want to have to maintain 2 sets of projects - so when I add a test I do not have to do this in 2 projects.Monday, September 07, 2009 12:18 PM
Well, the BuildShadowTask knows to switch between Desktop and Device by the second line in the .accessor file.
However, I (unsurprisingly) can't get it to work on the "wrong"/opposite project type.
It's very long now, I've been concerned about the issue, Anyone have got the solution? Thank you!Tuesday, January 25, 2011 11:51 PM