I would like to get rid of some duplication in this code. Following the DRY principle.
As you can see, the name of the file/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);
}
No, I cannot use another test framework than mstest ;-)
You could simply do this:
[TestClass]
public class Test
{
const string filename = "TestData/TestExcel.xlsx";
[TestMethod]
[DeploymentItem(filename)]
public void GivenAnExcel_ConverToPDF()
{
var result = pdfConverter.ConvertExcelDocument(filename);
AssertIsPdf(result);
}
}