public void GetHashCodeOfNullTest() { const int expected = 0; var actual = BlobComparer.GetBlobHashCode(null); Assert.Equal(expected, actual); }
public void GetHashCodeOfHalfIntTest() { const short expected = 31241; var actual = BlobComparer.GetBlobHashCode(BitConverter.GetBytes(expected)); Assert.Equal(expected, actual); }
public void GetHashCodeOfWholeIntTest() { const int expected = 402338134; var actual = BlobComparer.GetBlobHashCode(BitConverter.GetBytes(expected)); Assert.Equal(expected, actual); }
public void DeserializeBlob() { var expected = new BlobGraph { Value = Encoding.Unicode.GetBytes("Hello World") }; _context.AssertDeserialize("{\"value\": \"SABlAGwAbABvACAAVwBvAHIAbABkAA==\"}", expected, (l, r) => BlobComparer.CompareBlobs(l.Value, r.Value)); }
public void CompareRightGreaterTest() { var right = new Byte[] { 2, 1, 3 }; var left = new Byte[] { 1, 2, 3 }; const int expected = -1; Assert.Equal(expected, BlobComparer.CompareBlobs(left, right)); }
public void CompareRightIsNullTest() { var right = (byte[])null; var left = new Byte[] { 1, 2, 3 }; const int expected = 1; Assert.Equal(expected, BlobComparer.CompareBlobs(left, right)); }
public void CompareLeftLessTest() { var left = new Byte[] { 1, 0, 3 }; var right = new Byte[] { 1, 2, 3 }; const int expected = -1; Assert.Equal(expected, BlobComparer.CompareBlobs(left, right)); }
public void CompareEqualBothNullTest() { var left = (byte[])null; var right = (byte[])null; const int expected = 0; Assert.Equal(expected, BlobComparer.CompareBlobs(left, right)); }
public override bool Equals(object obj) { var other = obj as Category; if (other == null) { return(false); } return(Name == other.Name && Description == other.Description && BlobComparer.AreEqual(Image, other.Image)); }
public void GetHashCodeOfSeriesTest() { const int part1 = 402338134; const int part2 = 235436; const short part3 = 31241; var blob = new byte[10]; Array.Copy(BitConverter.GetBytes(part1), 0, blob, 0, 4); Array.Copy(BitConverter.GetBytes(part2), 0, blob, 4, 4); Array.Copy(BitConverter.GetBytes(part3), 0, blob, 8, 2); var actual = BlobComparer.GetBlobHashCode(blob); const int expected = part1 ^ part2 ^ part3; Assert.Equal(expected, actual); }
public override int GetHashCode() { return((Name == null ? 0 : Name.GetHashCode()) ^ (Description == null ? 0 : Description.GetHashCode()) ^ BlobComparer.GetBlobHashCode(Image)); }