Example #1
0
        public void ToStringX(byte[] correctBytes)
        {
            var uuid           = new Uuid(correctBytes);
            var expectedString = UuidTestsUtils.GetStringX(correctBytes);

            var actualString = uuid.ToString("X");

            Assert.AreEqual(expectedString, actualString);
        }
        public void TryFormatXCorrect(byte[] correctBytes)
        {
            var         uuid           = new Uuid(correctBytes);
            var         expectedString = UuidTestsUtils.GetStringX(correctBytes);
            Span <char> buffer         = stackalloc char[68];

            Assert.True(uuid.TryFormat(buffer, out int charsWritten, new ReadOnlySpan <char>(new[] { 'X' })));
            Assert.AreEqual(68, charsWritten);
            Assert.AreEqual(expectedString, new string(buffer));
        }