public void ToStringEmptyFormat(byte[] correctBytes) { var uuid = new Uuid(correctBytes); string expectedString = UuidTestsUtils.GetStringN(correctBytes); var actualString = uuid.ToString(string.Empty); Assert.AreEqual(expectedString, actualString); }
public void ToString(byte[] correctBytes) { var uuid = new Uuid(correctBytes); var expectedString = UuidTestsUtils.GetStringN(correctBytes); var actualString = uuid.ToString(); Assert.AreEqual(expectedString, actualString); }
public void TryFormatNullFormat(byte[] correctBytes) { var uuid = new Uuid(correctBytes); var expectedString = UuidTestsUtils.GetStringN(correctBytes); Span <char> buffer = stackalloc char[32]; Assert.True(uuid.TryFormat(buffer, out int charsWritten)); Assert.AreEqual(32, charsWritten); Assert.AreEqual(expectedString, new string(buffer)); }
public void TryFormatNCorrect(byte[] correctBytes) { var uuid = new Uuid(correctBytes); string expectedString = UuidTestsUtils.GetStringN(correctBytes); char * bufferPtr = stackalloc char[32]; var spanBuffer = new Span <char>(bufferPtr, 32); Assert.True(uuid.TryFormat(spanBuffer, out int charsWritten, new ReadOnlySpan <char>(new[] { 'N' }))); Assert.AreEqual(32, charsWritten); Assert.AreEqual(expectedString, new string(bufferPtr, 0, 32)); }