I would like to get rid of some duplication in this code. Following the principle of DRY.
As you can see, the file name / deploymentItem is repeated.
[TestMethod] [DeploymentItem("TestData/TestExcel.xlsx")] <-- public void GivenAnExcel_ConverToPDF() { const string filename = "TestData/TestExcel.xlsx"; <-- var result = pdfConverter.ConvertExcelDocument(filename); AssertIsPdf(result); }
- Is there a way to access DeploymentItem programmatically without using a file name?
Or - Can I get the file name programmatically?
No, I cannot use a different test structure than mstest ;-)
source share