Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Cannot run tests that rely on resource files
kevholditch
#1 Posted : Monday, December 17, 2012 9:27:50 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/17/2012(UTC)
Posts: 2
Location: United Kingdom

Thanks: 1 times

I am trying to build a test and run a test project that references resource files. The tests work fine in resharper but when nCrunch runs them I get an error stating:

System.Resources.MissingManifestResourceException : Could not find any resources appropriate for the specified culture or the neutral culture.

I believe this is because nCrunch is running with it's current thread culture set to neutral but I haven't got a resource file for that. Is there a way to set the thread current culture for nCrunch? Thanks in advance.
Remco
#2 Posted : Monday, December 17, 2012 10:40:45 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,986

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Hi, thanks for posting!

NCrunch will use the default culture for any .NET application on your machine (whatever that may be). There isn't anything specific in NCrunch that tries to control the culture, and it can't be configured in the tool itself. If your tests are culture-specific, you can set the culture using a SetUpFixture (NUnit) or AssemblyInitialize (MSTest) block using the following code:

System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-GB");

Under NUnit, you can also use the SetCultureAttribute.

Another possible situation that may cause this problem is if your project is making use of files in the resource manifest that are not included in the project file itself. NCrunch doesn't parse resource manifests, so it won't know about the resource files in order to copy them into workspaces it sets up to build your project. There's a page in the documentation that describes ways in which you can handle implicit file dependencies during project build. Although in theory the references to your resource files are declared explicitly rather than implicitly, NCrunch doesn't have enough knowledge of the workings of the resource compiler to understand the difference. You can either add the resource dependencies directly into your project file or use the 'additional files to include' configuration setting.
1 user thanked Remco for this useful post.
kevholditch on 12/18/2012(UTC)
kevholditch
#3 Posted : Tuesday, December 18, 2012 8:57:52 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/17/2012(UTC)
Posts: 2
Location: United Kingdom

Thanks: 1 times
Thank you so much for your help. The problem was that the satellite resource assemblies weren't being loaded by ncrunch (like you said). I added those files under the add additional files config setting in ncrunch and now it works.

I'm so happy with the ncrunch product, one of the best purchases I have made. Thanks again for your prompt help!
Remco
#4 Posted : Tuesday, December 18, 2012 10:05:39 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,986

Thanks: 931 times
Was thanked: 1257 time(s) in 1170 post(s)
Great to hear and thanks for the feedback! I hope NCrunch continues to live up to your expectations :)


Cheers,

Remco
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.035 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download