public void GetMonthlyDepreciation_Given12000LossIn1Year_ShouldReturn1000() { //---------------Set up test pack------------------- var asset = new Asset { Cost = 13000, Residual = 1000, Life = 1 }; //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var monthlyDepreciation = _calculator.GetMonthlyDepreciation(asset); //---------------Test Result ----------------------- Assert.AreEqual(1000, monthlyDepreciation); }
public decimal GetMonthlyDepreciation(Asset asset) { return (asset.Cost - asset.Residual)/asset.Life/12; }