Skip to content

Commit 2397f4d

Browse files
authored
Improve new Guid tests (#246)
***NO_CI***
1 parent cca059e commit 2397f4d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Tests/NFUnitTestSystemLib/UnitTestGuid.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,29 @@ public void Ctor_UInt_UShort_UShort_Byte_Byte_Byte_Byte_Byte_Byte_Byte_Byte()
419419
[TestMethod]
420420
public void NewGuid()
421421
{
422+
// generate a new Guid
422423
Guid guid1 = Guid.NewGuid();
423424

425+
OutputHelper.WriteLine($"Guid1: {guid1}");
426+
427+
// check that the guid is not empty
424428
Assert.AreNotEqual(Guid.Empty, guid1);
429+
// check version 4
425430
Assert.IsTrue((guid1.ToByteArray()[7] & 0xF0) == 0x40);
431+
// check variant
432+
Assert.IsTrue((guid1.ToByteArray()[8] & 0xC0) == 0x80);
426433

434+
// go for another one
427435
Guid guid2 = Guid.NewGuid();
428436

437+
OutputHelper.WriteLine($"Guid2: {guid2}");
438+
439+
// check that the guid is not empty
429440
Assert.AreNotEqual(guid1, guid2);
441+
// check version 4
430442
Assert.IsTrue((guid2.ToByteArray()[7] & 0xF0) == 0x40);
443+
// check variant
444+
Assert.IsTrue((guid2.ToByteArray()[8] & 0xC0) == 0x80);
431445
}
432446

433447
[TestMethod]

0 commit comments

Comments
 (0)