You could also use the not be empty
check on a GUID, that way you can use FluentAssertions's empty checking:
Guid.TryParse(iterTags.GUID, out var parsedIterTagsGUID)
parsedIterTagsGUID.Should().NotBeEmpty();
Or as extension:
public static AndConstraint<FluentAssertions.Primitives.GuidAssertions> ShouldBeGuid(this object value, string because = "", params object[] becauseArgs)
{
Guid.TryParse(value?.ToString(), out var guid);
return guid.Should().NotBeEmpty(because, becauseArgs);
}
The above can be done better, by extending something else like:
public static AndConstraint<GuidAssertions> BeGuid(this StringAssertions value, string because = "", params object[] becauseArgs)
{
Guid.TryParse(value.Subject, out var guid);
return guid.Should().NotBeEmpty(because, becauseArgs);
}
public static AndConstraint<GuidAssertions> BeGuid(this ObjectAssertions value, string because = "", params object[] becauseArgs)
{
return (value.Subject as Guid?).Should().NotBeNull().And.NotBeEmpty(because, becauseArgs);
}
Or maybe even better by proposing a pull request on: https://github.com/fluentassertions/fluentassertions