Peter Goodman bio photo

Peter Goodman

A developer living in Auckland building software using all sorts of bits and pieces I find along the way. Originally from Northern Ireland.

Twitter Google+ LinkedIn Github

We have a policy of using MS-Test, although that is overdue for a serious review.

So it turns out you can use the deployment item attribute....

[TestMethod]

[DeploymentItem("UnitTest.MyProject.TestData.xml")]

public void GetAllStatuses() {...}

....As long as you don’t provide a constant...

public const string XMLCONFIGFILE = "UnitTest.MyProject.TestData.xml";

[TestMethod]

[DeploymentItem(TestHelper.XMLCONFIGFILE)]

public void GetAllStatuses() {...}

It just ignores it.....Genius! Now my tests have to be littered with this string literal.

Makes you wonder how they are implementing this stuff.

Pete