Kevin Driedger
Kevin Driedger

Reputation: 54202

What is the MSTest Attribute for including a test resource?

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?

Upvotes: 3

Views: 1987

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1062780

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.

Upvotes: 3

Kevin Driedger
Kevin Driedger

Reputation: 54202

[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.

Upvotes: 4

Related Questions