MSTest data driven rows are cast to ints

2019-08-28 00:00发布

I have a data driven test (using MSTest) that has inputs that look like this:

ValuesToInput,ExpectedValue
0,0
00,00
000,000
0000,000
00000,000
000000,000

When I pull those out of my TestContext they are just 0. It has converted my string of 0000 to an int and gives me 0.

How can I make it give me my values as strings?

NOTE: My test method is setup like this:

[TestCategory("CodedUI"), DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "MyCvsFile.csv", "MyCvsFile#csv", DataAccessMethod.Sequential), DeploymentItem("DataDriven\\MyCvsFile.csv"), TestMethod]
public void DoMyTest()
{
    // My Test Stuff here

}

0条回答
登录 后发表回答