views:

146

answers:

2

I want to have a test resource that is available during my test and I know there is an attribute that deploys the item.

What is the attribute?

+1  A: 

[DeploymentItem("myFile1.txt")] MSDN Doc on DeploymentItem

This is really useful if you are testing against a file or using the file as input to your test.

Kevin Driedger
Here's a good website on this attribute:http://www.ademiller.com/blogs/tech/2007/10/gotchas-mstests-deploymentitem-attribute/
Kevin Driedger
+1  A: 

That really depends. Personally I hate the way that MSTest does this - either with the attribute or the separate "testrunconfig" file (add items in the "Deployment" section). I prefer the NUnit way (I use it with TestDriven.NET) - then if you want it to include a file in the output you do exactly what you would in regular VS projects; you toggle the "Copy to Output Directory" property.

Marc Gravell