/// <summary> /// Returns true if CreditCardInterest instances are equal /// </summary> /// <param name="other">Instance of CreditCardInterest to be compared</param> /// <returns>Boolean</returns> public bool Equals(CreditCardInterest other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( FeeRate == other.FeeRate || FeeRate != null && FeeRate.Equals(other.FeeRate) ) && ( InstalmentRate == other.InstalmentRate || InstalmentRate != null && InstalmentRate.Equals(other.InstalmentRate) ) && ( InterestRates == other.InterestRates || InterestRates != null && InterestRates.SequenceEqual(other.InterestRates) )); }
public void FeeRateComparison() { var a = new FeeRate(Money.Coins(2.0m)); var b = new FeeRate(Money.Coins(4.0m)); Assert.True(a < b); Assert.True(b > a); Assert.False(b < a); Assert.False(a > b); Assert.True(a != b); Assert.True(b != a); Assert.True(FeeRate.Min(a, b) == a); Assert.True(FeeRate.Min(b, a) == a); Assert.True(FeeRate.Max(a, b) == b); Assert.True(FeeRate.Max(b, a) == b); Assert.True(a.CompareTo(b) < 0); Assert.True(b.CompareTo(a) > 0); Assert.True(a.CompareTo(a) == 0); Assert.True(b.CompareTo(b) == 0); var aa = new FeeRate(Money.Coins(2.0m)); var bb = new FeeRate(Money.Coins(4.0m)); var o = new object(); Assert.True(a == aa); Assert.True(a.Equals(aa)); Assert.False(a.Equals(o)); Assert.True(b == bb); Assert.True(b != aa); Assert.True(b != (null as FeeRate)); Assert.True((null as FeeRate) == (null as FeeRate)); Assert.False((null as FeeRate) != (null as FeeRate)); Assert.False(a.Equals(b)); Assert.True(aa == a); Assert.True(bb == b); }