Skip to content

Conversation

@eNeRGy164
Copy link
Contributor

@eNeRGy164 eNeRGy164 commented Oct 4, 2020

For String assertions, [Not]Match, [Not]MatchEquivalentOf, [Not]MatchRegex and [Not]ContainMatch no longer accept a null or empty string as parameter.

The exception suggests to add a pattern or use one of the [Not]BeNull, [Not]BeEmpty or[Not]Contain methods if that behavior was intended.

Should also close #1243

IMPORTANT

  • The code complies with the Coding Guidelines for C#.
  • The changes are covered by a new or existing set of unit tests which follow the Arrange-Act-Assert syntax such as is used in this example.
  • If the contribution adds a feature or fixes a bug, please update the release notes, which are published on the website.
  • If the contribution changes the public API the changes needs to be included by running AcceptApiChanges.ps1/AcceptApiChanges.sh.
  • If the contribution affects the documentation, please include your changes in this pull request so the documentation will appear on the website.

@eNeRGy164 eNeRGy164 changed the title Guard [Not]Match, [Not]MatchEquivalentOf and [Not]MatchRegex against null or empty patterns Guard [Not]Match, [Not]MatchEquivalentOf, [Not]MatchRegex and [Not]ContainMatch against null or empty patterns Oct 4, 2020
Copy link
Member

@jnyrup jnyrup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and really nice with the guidance to users of which assertion method they should rather be using.

@dennisdoomen
Copy link
Member

Looks good and really nice with the guidance to users of which assertion method they should rather be using.

I second that. Thanks.

@dennisdoomen dennisdoomen merged commit 88967be into fluentassertions:develop Oct 5, 2020
@eNeRGy164 eNeRGy164 deleted the match-null-exception branch June 9, 2021 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

string.NotMatch() and Match() don't fail consistently with nulls

3 participants