Support DataSourceAttribute in .Net Core.
See original GitHub issueDescription
We have following code
[TestMethod]
[DeploymentItem("MyTests.Configuration.xml")]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\MyTests.Configuration.xml", "MyTestCase", DataAccessMethod.Sequential)]
public void GetFiles_OnRootDirectory_CallsApiCorrectly()
{
var foo = TestContext.DataRow["MyFooData"]);
}
with following xml file
<?xml version="1.0" encoding="utf-8" ?>
<Rows>
<MyTestCase>
<MyFooData>true</MyFooData>
</MyTestCase>
<MyTestCase>
<MyFooData>false</MyFooData>
</MyTestCase>
<OtherTestCase>
<MyFooData>false</MyFooData>
</OtherTestCase>
</Rows>
Is TestContext.DataRow
expected to come to MsTest v2, or is it any other way to do the same thing?
Steps to reproduce
- Install .NET Core 2.0.0-preview2-006497
- Target the test project to ,NET Core 2.0
- Use MSTest.TestAdapter version 1.2.0-beta
- Try to build
Expected behavior
The compile past
Actual behavior
I get following build error
error CS1061: ‘TestContext’ does not contain a definition for ‘DataRow’ and no extension method ‘DataRow’ accepting a first argument of type ‘TestContext’ could be found (are you missing a using directive or an assembly reference?)
Environment
.NET Core 2.0.0-preview2-006497 Visual Studio 15.3.0 preview 7.0 Windows 10
Issue Analytics
- State:
- Created 6 years ago
- Reactions:16
- Comments:47 (11 by maintainers)
Top Results From Across the Web
c# - What`s .Net core alternative of DataSource attribute for ...
Info: .NET Core does not support the DataSource attribute. If you try to access test data in this way in a .NET Core...
Read more >Create Data-Driven Unit Tests - Visual Studio (Windows)
Learn unit test concepts in C# and .NET through an interactive experience building a sample solution step-by-step using dotnet test and MSTest.
Read more >Work with data in ASP.NET Core Apps
ASP.NET Core supports various data access options, including Entity Framework Core (and Entity Framework 6 as well), and can work with any .NET ......
Read more >How to bind report to an object data source in .NET Core ...
I am working on a project in .NET Core. It is a web api and I am trying to use XtraReport, which since...
Read more >Problem with assigning DataSource for XtraReport in .Net ...
Hi, I have migrated Report from .Net Framework to .Net Core, I followed this https://docs.devexpress.com/XtraReports/401268/net-5-report- ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@rhyous
Therefore please take it into the consideration that it could be very easy workaround where things are not complicated as it in your projects.
Trying to move my Unit Tests to .NET Core 2.0. Of course, I have many row tests. I’ll have a look at Dynamic data. But the problem is all the existing row tests use DataSourceAttribute.