public void Should_return_Rounded_Negative_1000_for_Decimal_with_49_Cents() { decimal testInputs = -1000.49m; Int32 testResult = IntRounding.RoundToInt(testInputs); Assert.AreEqual(TEST_NEG_RESULT_NUMBER_DOWN, testResult); }
public void Should_return_Rounded_1000_for_Decimal_with_99_Cents() { decimal testInputs = 1000.99m; Int32 testResult = IntRounding.RoundToInt(testInputs); Assert.AreEqual(TEST_POS_RESULT_NUMBER_UP, testResult); }
public static Int32 RebateResult(decimal rebateBasis, decimal rebateApply, decimal rebateClaim) { decimal afterApply = decimal.Subtract(rebateBasis, rebateApply); decimal afterClaim = Math.Max(0m, decimal.Subtract(rebateClaim, afterApply)); decimal rebateResult = decimal.Subtract(rebateClaim, afterClaim); return(IntRounding.RoundToInt(rebateResult)); }
// ChildrenBonus public Int32 StatementChildrenBonus(MonthPeriod period, Int32 advancesTax, Int32 payerRebate, Int32 childrenAllowance, Int32 childrenRebate) { decimal bonusMaxChild = PeriodMaximumValidAmountOfTaxBonus(period); decimal bonusMinChild = PeriodMinimumValidAmountOfTaxBonus(period); decimal bonusForChild = decimal.Negate(Math.Min(0, childrenRebate - childrenAllowance)); decimal bonusResult = TaxingOperations.LimitToMinMax(bonusForChild, bonusMinChild, bonusMaxChild); return(IntRounding.RoundToInt(bonusResult)); }