public static void BlobId_Compare() { var blobId1 = new BlobId(s_hasher.HashData("abc")); var blobId2 = new BlobId(s_hasher.HashData("abc")); var blobId3 = new BlobId(s_hasher.HashData("def")); Assert.True(blobId1.CompareTo(blobId2) == 0); Assert.True(blobId1.CompareTo(blobId3) != 0); BlobId[] list = new[] { blobId1, blobId2, blobId3 }; Array.Sort(list); Assert.True(list[0] <= list[1]); Assert.True(list[2] >= list[1]); }
public static void BlobId_Compare() { var comparer = BlobIdComparer.Default; var blobId1 = new BlobId(Sha1.Hash("abc")); var blobId2 = new BlobId(Sha1.Hash("abc")); var blobId3 = new BlobId(Sha1.Hash("def")); var list = new[] { blobId1, blobId2, blobId3 }; Assert.True(blobId1.CompareTo(blobId2) == 0); Assert.True(blobId1.CompareTo(blobId3) != 0); Array.Sort(list, comparer.Compare); Assert.True(list[0] <= list[1]); Assert.True(list[2] >= list[1]); }