Peter Goodman bio photo

Peter Goodman

A software engineer and leader living in Auckland building products and teams. Originally from Derry, 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