Skip to content

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

@tomaustin700

Description

@tomaustin700

Description

If you attempt to do NotMatch(null) on a string it will fail when the string is not null

Complete minimal example reproducing the issue

// Arrange
string testString = "fdgkdfgkjdfg";

// Assert
testString.Should().NotMatch(null);

Expected behavior:

Test should pass as string is not null

Actual behavior:

Test fails

Versions

FluentAssertions 5.10.0
net core 3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions