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>();
        }
Пример #2
0
        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);
        }
Пример #3
0
 protected override void Remove(SoaRowDTO dto)
 => _moDB.GetMonthRepo(dto.GetDate()).Delete(dto);
Пример #4
0
 protected override void InsertOrUpdate(SoaRowDTO dto)
 => _moDB.GetMonthRepo(dto.GetDate()).Upsert(dto);
Пример #5
0
 public static DateTime GetDate(this SoaRowDTO dto)
 => DateTime.MinValue.AddDays(dto.DateOffset);
Пример #6
0
 public void Deposit(DateTime transactionDate, string subject, string description, decimal amount, string transactionRef)
 => UpsertAndUpdateBalances(SoaRowDTO
                            .Deposit(transactionDate, subject, description, amount, transactionRef));
Пример #7
0
 protected virtual void InsertOrUpdate(SoaRowDTO dto)
 => Upsert(dto);
Пример #8
0
 protected virtual void Remove(SoaRowDTO dto)
 => Delete(dto);
Пример #9
0
 public void DeleteAndUpdateBalances(SoaRowDTO dto)
 {
     Remove(dto);
     UpdateAllBalances();
 }
Пример #10
0
 public void UpsertAndUpdateBalances(SoaRowDTO dto)
 {
     InsertOrUpdate(dto);
     UpdateAllBalances();
 }
Пример #11
0
 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})");
        }