public void CreateNTUTest() { //arrange MLFSSale sale = new MLFSSale() { Id = 1, ReportingPeriodId = 6, Investment = 100, NetAmount = 4, OnGoingPercentage = (decimal)0.005, RelevantDate = DateTime.Parse("01/02/2020") }; MLFSReportingPeriod period = new MLFSReportingPeriod(5, 2020) { Id = 2 }; //act MLFSDebtorAdjustment adj = sale.CreateNTU(period); //assert Assert.AreEqual(-4, adj.Amount, "Amount is not the inverse of the debtor"); Assert.AreEqual(2, adj.ReportingPeriodId, "Correct reporting period not given."); Assert.AreEqual(true, adj.NotTakenUp, "Not reporting as an NTU adjustment"); }
public async Task <IActionResult> NotTakenUp(int?debtorId) { if (debtorId == null) { return(NotFound()); } MLFSSale mLFSSale = await _salesData.GetSaleById((int)debtorId); if (mLFSSale == null) { return(NotFound()); } MLFSReportingPeriod period = await _periodData.GetCurrent(); MLFSDebtorAdjustment adj = mLFSSale.CreateNTU(period); _adjustmentData.Insert(adj); return(RedirectToAction("Index", "Debtor")); }