public void EmptyArgConstructorTest() { MD5Checksum target = new MD5Checksum(new byte[0]); byte[] buffer = target.GetBuffer(); Assert.Equal(GetByteArray(0L, 0L), buffer); Assert.Equal(0L, target.HighBits); Assert.Equal(0L, target.LowBits); }
public void Array16ArgConstructorTest() { foreach (long highBits in new long[] { 0L, 0x12345678L, 0x32L }) { foreach (long lowBits in new long[] { 0L, 0x12345678L, 0x32L }) { MD5Checksum target = new MD5Checksum(GetByteArray(lowBits, highBits)); byte[] buffer = target.GetBuffer(); Assert.Equal(GetByteArray(lowBits, highBits), buffer); Assert.Equal(highBits, target.HighBits); Assert.Equal(lowBits, target.LowBits); } } }
public void ParseTest() { foreach (long highBits in new long[] { 0L, 0x12345678L, 0x32L }) { string h = highBits.ToString("x16"); foreach (long lowBits in new long[] { 0L, 0x12345678L, 0x32L }) { MD5Checksum target = MD5Checksum.Parse(h + lowBits.ToString("x16")); byte[] buffer = target.GetBuffer(); Assert.Equal(GetByteArray(lowBits, highBits), buffer); Assert.Equal(highBits, target.HighBits); Assert.Equal(lowBits, target.LowBits); } } }