public void Equality_DifferentTypes() { MonetaryQuantity fiver = new MonetaryQuantity(5m.Gbp()); Assert.That(fiver.Equals("gbp"), Is.False); Assert.That("GBP".Equals(fiver), Is.False); Assert.That(fiver.Equals(5m), Is.False); Assert.That(5m.Equals(fiver), Is.False); }
public void Equality_SameCurrencyAndAmount_True() { MonetaryQuantity fiver = new MonetaryQuantity(5m.Gbp()), anotherFiver = (MonetaryQuantity) new Money(5, Currency.Gbp); Assert.That(fiver.Equals(fiver), Is.True); Assert.That(fiver.Equals(anotherFiver), Is.True); Assert.That(anotherFiver.Equals(fiver), Is.True); Assert.That(fiver == anotherFiver, Is.True); Assert.That(anotherFiver == fiver, Is.True); }
public void Equality_DifferentAmountOrCurrency_False() { MonetaryQuantity fiver = new MonetaryQuantity(5m.Gbp()), tenner = (MonetaryQuantity)10m.Gbp(), hund = (MonetaryQuantity)100m.Dkk(); Assert.That(fiver.Equals(tenner), Is.False); Assert.That(tenner.Equals(fiver), Is.False); Assert.That(fiver == tenner, Is.False); Assert.That(tenner == fiver, Is.False); Assert.That(fiver.Equals(hund), Is.False); Assert.That(hund.Equals(fiver), Is.False); Assert.That(fiver == hund, Is.False); Assert.That(hund == fiver, Is.False); }