public void Test_ExtendedToStringForItemDeduction() { ItemDeduction itemDeduction = new ItemDeduction("Income Tax", (decimal)310); string result = itemDeduction.ExtendedToString(); string shouldbe = string.Format("{0}:{1:C}", "Income Tax", (decimal)310.00); Assert.AreEqual(shouldbe, result); }
public void Test_CalculateDeduction() { decimal grossAmount = (decimal)1000; ItemRates itemRates = new ItemRates("Income Tax", new[] { new Rate((decimal)0.00, (decimal)600.00, (decimal)25), new Rate((decimal)601.00, decimal.MaxValue, (decimal)40) }); IDeductionChargeCalculator chargeCalculator = new DeductionChargeCalculator(); PrivateObject obj = new PrivateObject(chargeCalculator); ItemDeduction itemDedution = (ItemDeduction)obj.Invoke("CalculateDeduction", grossAmount, itemRates); Assert.AreEqual("Income Tax", itemDedution.DeductionItemName); Assert.AreEqual((decimal)310, itemDedution.DeductionCharge); }