From 5f35832260a5c983cd67260d51c52aa5d7e5cee0 Mon Sep 17 00:00:00 2001 From: Lukas Gasselsberger Date: Thu, 14 Apr 2022 12:03:38 +0200 Subject: [PATCH] Add missing test for matching `null` with wildcard string --- .../Primitives/StringAssertionSpecs.Match.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tests/FluentAssertions.Specs/Primitives/StringAssertionSpecs.Match.cs b/Tests/FluentAssertions.Specs/Primitives/StringAssertionSpecs.Match.cs index c69f57892f..6ae41f3094 100644 --- a/Tests/FluentAssertions.Specs/Primitives/StringAssertionSpecs.Match.cs +++ b/Tests/FluentAssertions.Specs/Primitives/StringAssertionSpecs.Match.cs @@ -81,6 +81,20 @@ public void When_a_string_is_matched_against_null_it_should_throw_with_a_clear_e .WithParameterName("wildcardPattern"); } + [Fact] + public void Null_does_not_match_to_any_string() + { + // Arrange + string subject = null; + + // Act + Action act = () => subject.Should().Match("*"); + + // Assert + act.Should().Throw() + .WithMessage("Expected subject to match *, but found ."); + } + [Fact] public void When_a_string_is_matched_against_an_empty_string_it_should_throw_with_a_clear_explanation() {