I have UWP project. Using VS Community 2017 I added a unit test to my solution (Add project-> Windows Universal -> Unit Test App (Windows Universal)),
I added reference to my project, I added .csv file with test data, I added DataSource Attribute
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestProject1
{
[TestClass]
public class UnitTest1
{
private TestContext testContextInstance;
public TestContext TestContext
{
get { return testContextInstance; }
set { testContextInstance = value; }
}
[TestMethod()]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV",
@".\TestData.csv", "TestData#csv", DataAccessMethod.Sequential)]
public void ParameterizedTest()
{
int value = Convert.ToInt32(TestContext.DataRow["Row1"]);
But still I can't use TestContext.DataRow
Error CS1061 'TestContext' does not contain a definition for 'DataRow' and no accessible extension method 'DataRow' accepting a first argument of type 'TestContext' could be found (are you missing a using directive or an assembly reference?)
Do I miss something?
Are you using .NET Core?
The .Net Core version of the adapter does not support DataSource yet as specified here https://github.com/Microsoft/testfx/issues/233
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With