Skip to content

Improve error message on EmptyConstraint #2928

@ChrisMaddock

Description

@ChrisMaddock

When EmptyConstraint is used on the incorrect type, it throws the following exception:

throw new System.ArgumentException("The actual value must be a string or a non-null IEnumerable or DirectoryInfo", nameof(actual));

When chaining constraints, I sometimes hit this error message because of problems in my chaining, where I'm actually testing against a different type to the one I think I am. It would be useful if this error message included the type of actual which caused the exception - so the user can better debug where the problem in their chaining lies.

Ideally, whoever contributes this functionality would also add a corresponding unit test! There may already be something there - I haven't checked. 🙂

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions