コード例 #1
0
        public void ToStringD(byte[] correctBytes)
        {
            var uuid           = new Uuid(correctBytes);
            var expectedString = UuidTestsUtils.GetStringD(correctBytes);

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

            Assert.AreEqual(expectedString, actualString);
        }
コード例 #2
0
        public void TryFormatDCorrect(byte[] correctBytes)
        {
            var         uuid           = new Uuid(correctBytes);
            var         expectedString = UuidTestsUtils.GetStringD(correctBytes);
            Span <char> buffer         = stackalloc char[36];

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