Skip to content

GuidAssertions.Be(string) throws FormatException for invalid input #1553

@jnyrup

Description

@jnyrup

Description

When providing a string not convertible to a Guid GuidAssertions.Be(string) throws a FormatException.

We have two options:

  1. Keep the overload taking a string and validate it using Guid.TryParse
  2. Delete the overload and let users pass in a typed Guid.

I vote for the second.

Complete minimal example reproducing the issue

Guid.NewGuid().Should().Be("");

Expected behavior:

We should not throw a FormatException.

Actual behavior:

We throw a FormatException.

Versions

  • Fluent Assertions 5.10.3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions