Skip to main content

Guid

Describes the possible expectations for Guid values.

Equality

You can verify, that the Guid is equal to another one or not:

Guid subject = Guid.Parse("5c01d9d2-66f7-4782-8c14-e54eae9aaacc");

await Expect.That(subject).IsEqualTo(Guid.Parse("5c01d9d2-66f7-4782-8c14-e54eae9aaacc"))
.Because("they are the same");
await Expect.That(subject).IsNotEqualTo(Guid.Parse("cdd7a485-40a1-4bba-bb8b-d0e903704b02"))
.Because("they differ");

Empty

You can verify, that the Guid is empty or not:

await Expect.That(Guid.Empty).IsEmpty();
await Expect.That(Guid.NewGuid()).IsNotEmpty();