-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC011 - Custom data sources #4092
Comments
Ideally we want the new attribute to implement the same interface as the other source attributes. Outside of technical constraints, we would also like to unfold arguments and declare them on the method signature instead of using the Finally, I think we should drop the |
@Evangelink Thanks. I updated the proposal a little bit. |
One consideration for not having If we go with parameters instead of In that case, we may be able to have the test parameter as [TestMethod]
[XmlDataSource("MyTests.Configuration.xml", "MyTable1")]
public void TestMethod(DataRow dataRow /*alternative of TestContext.DataRow*/)
{
} |
That's a good remark, we probably need wrapper type yeah. |
@Evangelink Is it "our own new wrapper type"? Or could we just use "DataRow"? (available in all .NET versions without extra packages) |
Thanks for your input @fforjan. I read it as our solution wouldn't be helping you much, am I right? Giving some more thoughts on it, I am actually wondering if this feature is actually bringing much to our users. I mean that either we will end up in a too generic solution where user is basically left with a too generic argument type or something too narrow where the user ends up having to write its own extension. For XML, I don't think we are really providing much value as (nearly) everything is already available out-of-the-box. For CSV, we would need to either re-implement a parser which is a no-go or rely on some library from community (with licensing/security/support concerns) but even there, I have the feeling we will either have too generic type or too narrow which means we don't have the right abstraction. Finally, for databases, this seems to be even more true. I am more tempted to invest some time in offering a different fixture experience that would give the flexibility to use the library and srong typing the user wants. I'll sleep on it. |
RFC 011 - Custom data sources
Summary
A replacement for DataSourceAttribute, which is currently .NET Framework only, to make it more modern and bring the support for .NET Core.
Motivation
User needs for DataSource to be supported on .NET Core. #233
Detailed design
Instead of having a single giant attribute like DataSourceAttribute, we will divide it into multiple attributes.
XmlDataSourceAttribute
The attribute constructor will have three parameters,
(string xmlFilePath, string tableName)
Previously with
DataSrouceAttribute
, the code used to look like this:XML file:
Now, it will be:
The attribute will implement
ITestDataSource
and may be in a separate package.CSVDataSourceAttribute
The attribute constructor will have one parameters,
(string csvFilePath)
Previously with
DataSrouceAttribute
, the code used to look like this:Now, it will be:
The attribute will implement
ITestDataSource
and may be in a separate package.SqlDataSourceAttribute
TBD
Concerns:
Drawbacks
Why should we not do this?
Alternatives
What other designs have been considered? What is the impact of not doing this?
Compatibility
This change isn't a breaking change. But it brings functionality to .NET ("Core") that is done differently on .NET Framework
Unresolved questions
What parts of the design are still TBD?
The text was updated successfully, but these errors were encountered: