I really hope today’s release of VST2010 will solve this issue. In my current setup, VST2010 RC and SharePoint 2010 beta its not really possible building Unit Test against SPMetal.
I have a simple DomainModel and DomainModelTest project.
The DomainModel project contains the SPMetal autogenerated MySystem.cs file.
The DomainModelTest project contains a unit test to test the DomainModel as expected.
The test :
[TestMethod()]
public void DataleverandoerTest()
{
ResourceManager resMgr = new ResourceManager("DomainModelTest.TestSettings", Assembly.GetExecutingAssembly());
string requestUrl = resMgr.GetString("weburl"); // TODO: Initialize to an appropriate value
IUSystemDataContext target = new IUSystemDataContext(requestUrl); // TODO: Initialize to an appropriate value
EntityList<Item> actual;
actual = target.Dataleverandoer;
Assert.Inconclusive("Verify the correctness of this test method.");
The immidiate error :
Test method DomainModelTest.IUSystemDataContextTest.DataleverandoerTest threw exception:
System.IO.FileNotFoundException:
Srini Sistla found out that this happens because the test project is running under .net Framework 4.0. Thanks Srini it could have had me blocked for hours ;)
http://codename-srini.blogspot.com/2010/03/error-systemiofilenotfoundexception-was.html
The simple solution: #FAIL
Change the framework to 3.5… FAIL. IT CANT BE DONE IN VST2010 RC !! And its a well know bug : https://connect.microsoft.com/VisualStudio/feedback/details/483939/unable-to-change-target-framework-version-on-unit-test-projects
Today is 2010 release day. I really hope it’s fixed and will get back to Y’all. Otherwise its back to the good old NUnit or similar.
Michael Høtoft
53e3fa76-4ade-4b6f-a857-094829cbafd9|0|.0
Sharepoint Server, Visual Studio 2010
sharepoint 2010; visual studio 2010