question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[API Suggestion]: DataTableCollection and DataColumnCollection ContainItemWithName

See original GitHub issue

The 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:closed
  • Created a year ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
logiclrdcommented, Apr 18, 2022

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.

0reactions
jnyrupcommented, Apr 25, 2022

That settles it then. Thanks for the discussion.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found