public void FromDifference_TotalSmaller_NegativePercentage() { DecimalPercentage twiceAsSmall = DecimalPercentage.FromDifference(10L, 20L); Assert.That(twiceAsSmall.Value, Is.EqualTo(-100m)); twiceAsSmall = DecimalPercentage.FromDifference(10m, 20m); Assert.That(twiceAsSmall.Value, Is.EqualTo(-100d)); }
public void FromDifference_TotalBigger_PositivePercentage() { DecimalPercentage fiftyPercentBigger = DecimalPercentage.FromDifference(20L, 10L); Assert.That(fiftyPercentBigger.Value, Is.EqualTo(50m)); fiftyPercentBigger = DecimalPercentage.FromDifference(20m, 10m); Assert.That(fiftyPercentBigger.Value, Is.EqualTo(50d)); }
public void FromDifference_ZeroTotal_HundredPercent() { DecimalPercentage hundredPercentMore = DecimalPercentage.FromDifference(15, 0); Assert.That(hundredPercentMore.Value, Is.EqualTo(100m)); Assert.That(hundredPercentMore.Fraction, Is.EqualTo(1m)); hundredPercentMore = DecimalPercentage.FromDifference(long.MaxValue, 0); Assert.That(hundredPercentMore.Value, Is.EqualTo(100d)); Assert.That(hundredPercentMore.Fraction, Is.EqualTo(1d)); }