[API Suggestion]: DataTableCollection and DataColumnCollection ContainItemWithName
See original GitHub issueThe DataTableCollection
and DataColumnCollection
types in System.Data have items with logical names. An API enhancement is proposed to allow succinct expression of assertions that these collections contain items with provided names. This functionality was originally implemented within pull request #1812, but has been separated off for independent consideration in pull request #1893.
Specific API surface changes proposed:
public static class DataTableCollectionAssertionExtensions
{
public static AndConstraint<GenericCollectionAssertions<DataTable>> ContainTableWithName(this GenericCollectionAssertions<DataTable> assertion, string expectedTableName, string because = "", params object[] becauseArgs) { }
public static AndConstraint<GenericCollectionAssertions<DataTable>> NotContainTableWithName(this GenericCollectionAssertions<DataTable> assertion, string unexpectedTableName, string because = "", params object[] becauseArgs) { }
}
public static class DataColumnCollectionAssertionExtensions
{
public static AndConstraint<GenericCollectionAssertions<DataColumn>> ContainColumnWithName(this GenericCollectionAssertions<DataColumn> assertion, string expectedColumnName, string because = "", params object[] becauseArgs) { }
public static AndConstraint<GenericCollectionAssertions<DataColumn>> NotContainColumnWithName(this GenericCollectionAssertions<DataColumn> assertion, string unexpectedColumnName, string because = "", params object[] becauseArgs) { }
}
Issue Analytics
- State:
- Created a year ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
DataTableCollection Class (System.Data)
The first procedure in this example retrieves the DataTableCollection of a DataSet and prints the value of each column, in each row, of...
Read more >DataColumnCollection Class (System.Data)
Represents a collection of DataColumn objects for a DataTable. ... The DataColumnCollection defines the schema of a DataTable, and determines what kind of ......
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
I created these for parity with other collection assertions, but it wouldn’t be unreasonable to argue that the likelihood of encountering the collection without its containing type is vanishingly small, and the containing type can already do equivalent assertions.
That settles it then. Thanks for the discussion.