public void ExtractByteArrayOptimizedTest(int size) { byte[] data = Enumerable.Range(0, size).Select(o => (byte)(o % 256)).ToArray(); Google.Protobuf.ByteString btStr = ProtoBufByteStringHelper.CreateFromByteArrayOptimized(data); var extractedArray = ProtoBufByteStringHelper.ExtractByteArrayOptimized(btStr); Assert.Equal(data, extractedArray); if (ProtoBufByteStringHelper.CanExtractByteArrayOptimized() && ProtoBufByteStringHelper.CanCreateFromByteArrayOptimized() && data.Length >= ProtoBufByteStringHelper.ExtractObjectIndexFromMemoryWithReflectionThreshold) Assert.True(object.ReferenceEquals(data, extractedArray)); }
public void AttachBytesIsAvailableTest() { Assert.True(ProtoBufByteStringHelper.CanCreateFromByteArrayOptimized()); }