public static void NotEqual(byte[] bytes) { var expected = new Nonce(new byte[] { 0xFF, 0xFF }, 0); var actual = new Nonce(bytes, 0); Assert.NotEqual(expected, actual); Assert.NotEqual(expected.GetHashCode(), actual.GetHashCode()); Assert.False(expected.Equals(actual)); Assert.False(expected.Equals((object)actual)); Assert.False(expected == actual); Assert.True(expected != actual); }
public static void Equal(int size) { var expected = new Nonce(Utilities.RandomBytes.Slice(0, size), 0); var actual = new Nonce(Utilities.RandomBytes.Slice(0, size), 0); Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); Assert.True(actual.Equals(expected)); Assert.True(actual.Equals((object)expected)); Assert.True(actual == expected); Assert.False(actual != expected); }
/// <summary> /// Returns true if InputSignaturesTimestamp instances are equal /// </summary> /// <param name="other">Instance of InputSignaturesTimestamp to be compared</param> /// <returns>Boolean</returns> public bool Equals(InputSignaturesTimestamp other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Hash == other.Hash || Hash != null && Hash.Equals(other.Hash) ) && ( HashAlgo == other.HashAlgo || HashAlgo != null && HashAlgo.Equals(other.HashAlgo) ) && ( Nonce == other.Nonce || Nonce != null && Nonce.Equals(other.Nonce) ) && ( ClientData == other.ClientData || ClientData != null && ClientData.Equals(other.ClientData) )); }
public override bool Equals(object obj) { return(obj is Block item && Hash.Equals(item.Hash) && Index.Equals(item.Index) && Difficulty.Equals(item.Difficulty) && PreviousBlockHash.Equals(item.PreviousBlockHash) && MinedBy.Equals(item.MinedBy) && Nonce.Equals(item.Nonce) && CreatedOn.Equals(item.CreatedOn) && Transactions.SequenceEqual(item.Transactions)); }
public static void EqualBytes() { var bytes1 = new byte[Nonce.MaxSize]; var bytes2 = new byte[Nonce.MaxSize]; for (var i = 0; i < bytes1.Length; i++) { bytes1[i] = 1; for (var j = 0; j < bytes2.Length; j++) { bytes2[j] = 1; var expected = new Nonce(bytes1, 0); var actual = new Nonce(bytes2, 0); if (i == j) { Assert.Equal(expected, actual); Assert.Equal(expected.GetHashCode(), actual.GetHashCode()); Assert.True(actual.Equals(expected)); Assert.True(actual.Equals((object)expected)); Assert.True(actual == expected); Assert.False(actual != expected); } else { Assert.NotEqual(expected, actual); Assert.NotEqual(expected.GetHashCode(), actual.GetHashCode()); Assert.False(expected.Equals(actual)); Assert.False(expected.Equals((object)actual)); Assert.False(expected == actual); Assert.True(expected != actual); } bytes2[j] = 0; } bytes1[i] = 0; } }
private bool EqualsData(IpV6OptionIdentifierLocatorNetworkProtocolNonce other) { return(other != null && Nonce.Equals(other.Nonce)); }