public void Can_close_ledger_period() { var testCoa = this.GetTestChartOfAccounts(1); _chartOfAccountsService.CloseLedgerPeriod(testCoa.Id); _mockRepo.Verify(x => x.Create(It.IsAny <LedgerAccountBalance>()), Times.Exactly(4)); _mockRepo.Verify(x => x.Save(), Times.Once); }
public IActionResult CloseCurrentPeriod(int id) { try { _chartOfAccountsService.CloseLedgerPeriod(id); var coa = _chartOfAccountsService.GetChartOfAccountsById(id); return(new JsonResult(coa.CurrentLedgerPeriodStartDate.ToString("dd-MM-yyyy"))); } catch (Exception) { // return the error. return(BadRequest(new { Error = "An error occured while closing period." })); } }