public void TestGetHashCode() { // anything that is equal must have the same hashCode BigDecimal hash = BigDecimal.Parse("1.00"); BigDecimal hash2 = new BigDecimal(1.00D); Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2), "the hashCode of 1.00 and 1.00D is equal"); hash2 = BigDecimal.Parse("1.0"); Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2), "the hashCode of 1.0 and 1.00 is equal"); BigInteger val = BigInteger.Parse("100"); hash2 = new BigDecimal(val, 2); Assert.IsTrue(hash.GetHashCode() == hash2.GetHashCode() && hash.Equals(hash2), "hashCode of 1.00 and 1.00(bigInteger) is not equal"); hash = new BigDecimal(value, 2); hash2 = BigDecimal.Parse("-1233456.0000"); Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2), "hashCode of 123459.08 and -1233456.0000 is not equal"); hash2 = new BigDecimal(value.Negate(), 2); Assert.IsTrue(hash.GetHashCode() != hash2.GetHashCode() && !hash.Equals(hash2), "hashCode of 123459.08 and -123459.08 is not equal"); }