I am trying to find the most fluent manner to assert that a certain string is a valid Guid.
iterTags.GUID
is a string
.
My first attempt ended in error because string
does not implement Guid
. Okay, I saw it coming as it was a shot in the dark
iterTags.GUID.Should().BeAssignableTo<Guid>();
So i came up with this working solution but it's not fluent
Guid parsedGuid;
if (!Guid.TryParseExact(iterTags.GUID, "D", out parsedGuid))
Assert.Fail("iterTags.GUID: '{0}' is not a valid guid");
Reading the documentation I found no better way of doing the assertion.
My question: Is there a fluent way of asserting a string is a valid Guid
Perhaps, something like...
iterTags.GUID.Should().BeParsedAs<Guid>()