public async Task ShouldUpdate_CashTransaction_UsingCashAccountAggregate()
        {
            CashAccount account = await _cashAcctRepo.GetByIdAsync(new Guid("417f8a5f-60e7-411a-8e87-dfab0ae62589"));

            CashAccountTransaction transaction = account.CashAccountTransactions.FirstOrDefault(p => p.Id.Equals(25));

            transaction.UpdateCashAcctTransactionDate(CashAcctTransactionDate.Create(new DateTime(2021, 10, 16)));
            transaction.UpdateCashAcctTransactionAmount(CashAcctTransactionAmount.Create(8664.99M));

            //TODO Need to know the business rules for these two.
            // transaction.UpdateExternalAgentId(cashAccountTransaction.AgentId);
            // transaction.UpdateEconomicEventId(cashAccountTransaction.EventId);

            transaction.UpdateCheckNumber(CheckNumber.Create("99999"));
            transaction.UpdateRemittanceAdvice("0000000");
            transaction.UpdateUserId(UserId.Create(new Guid("4b900a74-e2d9-4837-b9a4-9e828752716e")));

            account.UpdateCashAccountTransaction(transaction);
            _cashAcctRepo.Update(account);
            await _unitOfWork.Commit();

            CashAccountTransaction result = account.CashAccountTransactions.FirstOrDefault(p => p.Id.Equals(25));

            Assert.Equal(transaction.CashAcctTransactionDate, result.CashAcctTransactionDate);
            Assert.Equal(transaction.CashAcctTransactionAmount, result.CashAcctTransactionAmount);
            Assert.Equal(transaction.CheckNumber, result.CheckNumber);
            Assert.Equal(transaction.RemittanceAdvice, result.RemittanceAdvice);
            Assert.Equal(transaction.UserId, result.UserId);
        }
 public void Configure(EntityTypeBuilder <CashAccountTransaction> entity)
 {
     entity.ToTable("CashAccountTransactions", schema: "Finance");
     entity.HasKey(e => e.Id);
     entity.Property(p => p.Id).HasColumnType("INT").HasColumnName("CashTransactionId");
     entity.Property(p => p.CashAccountId)
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("CashAccountId")
     .IsRequired();
     entity.Property(p => p.CashTransactionType)
     .HasColumnType("INT")
     .HasColumnName("CashTransactionTypeId")
     .IsRequired();
     entity.Property(p => p.CashAcctTransactionDate)
     .HasConversion(p => p.Value, p => CashAcctTransactionDate.Create(p))
     .HasColumnType("datetime2(0)")
     .HasColumnName("CashAcctTransactionDate")
     .IsRequired();
     entity.Property(p => p.CashAcctTransactionAmount)
     .HasConversion(p => p.Value, p => CashAcctTransactionAmount.Create(p))
     .HasColumnType("DECIMAL(18,2)")
     .HasColumnName("CashAcctTransactionAmount")
     .IsRequired();
     entity.Property(p => p.AgentId)
     .HasConversion(p => p.Value, p => ExternalAgentId.Create(p))
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("AgentId")
     .IsRequired();
     entity.Property(p => p.EventId)
     .HasConversion(p => p.Value, p => EconomicEventId.Create(p))
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("EventId")
     .IsRequired();
     entity.Property(p => p.CheckNumber)
     .HasConversion(p => p.Value, p => CheckNumber.Create(p))
     .HasColumnType("NVARCHAR(25)")
     .HasColumnName("CheckNumber")
     .IsRequired();
     entity.Property(p => p.RemittanceAdvice)
     .HasColumnType("NVARCHAR(50)")
     .HasColumnName("RemittanceAdvice");
     entity.Property(p => p.UserId)
     .HasConversion(p => p.Value, p => UserId.Create(p))
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("UserId")
     .IsRequired();
     entity.Property(e => e.CreatedDate)
     .HasColumnType("datetime2(7)")
     .ValueGeneratedOnAdd()
     .HasDefaultValueSql("sysdatetime()");
     entity.Property(e => e.LastModifiedDate).HasColumnType("datetime2(7)");
 }
        public async Task ShouldInsert_CashTransaction_UsingCashAccountAggregate()
        {
            CashAccount account = await _cashAcctRepo.GetByIdAsync(new Guid("6a7ed605-c02c-4ec8-89c4-eac6306c885e"));

            CashAccountTransaction transaction = new CashAccountTransaction
                                                 (
                CashTransactionType.CashDisbursementLoanPayment,
                CashAccountId.Create(account.Id),
                CashAcctTransactionDate.Create(new DateTime(2021, 11, 7)),
                CashAcctTransactionAmount.Create(4363.82M),
                ExternalAgentId.Create(new Guid("12998229-7ede-4834-825a-0c55bde75695")),
                EconomicEventId.Create(new Guid("cf4279a1-da26-4d10-bff0-cf6e0933661c")),
                CheckNumber.Create("12214554"),
                "12M877",
                UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744"))
                                                 );

            account.AddCashAccountTransaction(transaction);
            _cashAcctRepo.Update(account);
            await _unitOfWork.Commit();
        }