-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Labels
api-approvedAPI was approved, it can be implementedAPI was approved, it can be implementedenhancement
Milestone
Description
Background and motivation
Now there is method ContainItemsAssignableTo<T> and it's very usefull for sequence validation. But sometimes I need to check that sequence does not contain any elements of specified type. So I need to write somethink like this:
var myList = GetListForAssert();
myList.Should().ContainItemsAssignableTo<MyType1>();
myList.OfType<MyType2>().Should().BeEmpty();API Proposal
public class GenericCollectionAssertions<TCollection, T, TAssertions>
{
public AndConstraint<TAssertions> NotContainItemsAssignableTo<T>(string because="", params object[] becauseArgs)
public AndConstraint<TAssertions> NotContainItemsAssignableTo(Type type, string because="", params object[] becauseArgs)
}API Usage
var myList = GetList();
myList.Should().NotContainItemsAssignableTo<MyType>();Alternative Designs
No response
Risks
No response
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved, it can be implementedAPI was approved, it can be implementedenhancement