-
Notifications
You must be signed in to change notification settings - Fork 731
Closed
Milestone
Description
Description
Is there any difference between ContainItemsAssignableTo and AllBeAssignableTo?
Spending five minutes looking at them, they seem to test the same scenario.
(With the exception, that AllBeAssignableTo has special handling for IEnumerable<Type>)
In contrast to other Contain methods, ContainItemsAssignableTo expects all elements to satisfy and not just a subset.
Complete minimal example reproducing the issue
class Base { }
class Derived : Base { }
public void MyTestMethod()
{
new[] { new Derived(), new Base() }.Should().AllBeAssignableTo<Derived>(); // fails as expected
new[] { new Derived(), new Base() }.Should().ContainItemsAssignableTo<Derived>(); // <-- I would have expected this to pass
}kimsey0, siewers and fraser-lowndes