In MsTest if I need some file from another project for my test, I can specify DeploymentItem attribute. Is there anything similar in NUnit?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should check out another thread that contrasts the capabilities of NUnit and MSTest.
The accepted answer here is misleading. NUnit does not offer the [DeploymentItem(“”)] attribute at all which is what @Idsa wanted an equivalent solution for in NUnit.
My guess is that this kind of attribute would violate the scope of NUnit as a “unit” testing framework as requiring an item to be copied to the output before running a test implies it has a dependency on this resource being available.
I’m using a custom attribute to copy over a localdb instance for running “unit” tests against some sizeable test data that I’d rather not generate with code everytime.
Now using the attribute [DeploymentItem(“some/project/file”)] will copy this resource from file system into the bin again effectively refreshing my source data per test method:
Then we can use like so: