Пример #1
0
        public void ToStringP(byte[] correctBytes)
        {
            var uuid           = new Uuid(correctBytes);
            var expectedString = UuidTestsUtils.GetStringP(correctBytes);

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

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

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