public void Digest() { var nullId = new Fingerprint(ValueKind.Null, 1); Assert.Empty(nullId.Digest); Assert.Empty(nullId.GetDigest()); var binId = new Fingerprint(ValueKind.Binary, 5, new byte[] { 1, 2, 3, 4, 5 }); Assert.Equal(new byte[] { 1, 2, 3, 4, 5 }, binId.GetDigest()); Assert.Equal(binId.GetDigest(), binId.Digest); var hash = new Random().NextBytes(20); var listId = new Fingerprint(ValueKind.List, 123, hash); Assert.Equal(hash, listId.Digest); Assert.Equal(hash, listId.GetDigest()); }
public void Constructor() { var f = new Fingerprint(ValueKind.Binary, 5, new byte[] { 1, 2, 3, 4, 5 }); Assert.Equal(ValueKind.Binary, f.Kind); Assert.Equal(5L, f.EncodingLength); Assert.Equal(new byte[] { 1, 2, 3, 4, 5 }, f.GetDigest()); byte[] hash = new Random().NextBytes(20); f = new Fingerprint(ValueKind.List, 100, hash); Assert.Equal(ValueKind.List, f.Kind); Assert.Equal(100L, f.EncodingLength); Assert.Equal(hash, f.GetDigest()); }