public void Rejectspredatedtxn() { var sut = CreateSUT(31.March(2018), 899_327.02M); sut.ClosingBalanceFor(31.March(2018)).Should().Be(899_327.02M); Action act = () => sut.Insert(SoaRowDTO.Deposit (30.March(2018), "before base balance", "", 123.45M, "")); act.Should().Throw <PredatesBaseBalanceException>(); }
private static SoaRowDTO ToClearedTransaction(RequestedChequeDTO chq, DateTime clearedDate) { var req = chq.Request; var dto = SoaRowDTO.Withdrawal(clearedDate, req.Payee, req.Purpose, req.Amount.Value, chq.ChequeNumber.ToString()); dto.DocRefId = chq.Id; dto.DocRefType = chq.GetType().FullName; dto.DocRefJson = chq.ToJson(true); return(dto); }
protected override void Remove(SoaRowDTO dto) => _moDB.GetMonthRepo(dto.GetDate()).Delete(dto);
protected override void InsertOrUpdate(SoaRowDTO dto) => _moDB.GetMonthRepo(dto.GetDate()).Upsert(dto);
public static DateTime GetDate(this SoaRowDTO dto) => DateTime.MinValue.AddDays(dto.DateOffset);
public void Deposit(DateTime transactionDate, string subject, string description, decimal amount, string transactionRef) => UpsertAndUpdateBalances(SoaRowDTO .Deposit(transactionDate, subject, description, amount, transactionRef));
protected virtual void InsertOrUpdate(SoaRowDTO dto) => Upsert(dto);
protected virtual void Remove(SoaRowDTO dto) => Delete(dto);
public void DeleteAndUpdateBalances(SoaRowDTO dto) { Remove(dto); UpdateAllBalances(); }
public void UpsertAndUpdateBalances(SoaRowDTO dto) { InsertOrUpdate(dto); UpdateAllBalances(); }
public SoaRowVM(SoaRowDTO soaRowDTO) { DTO = soaRowDTO; }
public PredatesBaseBalanceException(SoaRowDTO dto, DateTime baseBalDate) : base(GetMessage(dto, baseBalDate)) { }
private static string GetMessage(SoaRowDTO dto, DateTime baseBalDate) { var dtoDesc = $"[{dto.GetDate():d MMM yyyy}] “{dto.Subject}”"; return($"{dtoDesc} predates base balance ({baseBalDate:d MMM yyyy})"); }