public async Task ShouldInsert_LoanPymt_UsingLoanAgreementAggregate() { LoanAgreement agreement = await _loanAgreementRepo.GetByIdAsync(new Guid("0a7181c0-3ce9-4981-9559-157fd8e09cfb")); EconomicEvent economicEvent = new EconomicEvent(Guid.NewGuid(), EventType.CashDisbursementForLoanPayment); await _loanAgreementRepo.AddEconomicEventAsync(economicEvent); LoanPayment loanPayment = new LoanPayment ( economicEvent, agreement, PaymentNumber.Create(1), PaymentDueDate.Create(new DateTime(2021, 12, 5)), LoanPrincipalAmount.Create(14135.13M), LoanInterestAmount.Create(984), LoanPrincipalRemaining.Create(160862.13M), UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744")) ); agreement.AddLoanPayment(loanPayment); _loanAgreementRepo.Update(agreement); await _unitOfWork.Commit(); LoanPayment result = agreement.LoanPayments.FirstOrDefault(p => p.Id == loanPayment.EconomicEvent.Id); Assert.NotNull(result); }
public void Should_detect_speech_and_conf() { var eEvnt = new EconomicEvent { }; Assert.IsTrue(eEvnt.IsSpeechOrMeeting); }
public LoanPayment ( EconomicEvent economicEvent, LoanAgreement loanAgreement, PaymentNumber paymentNumber, PaymentDueDate paymentDueDate, LoanPrincipalAmount principalAmount, LoanInterestAmount interestAmount, LoanPrincipalRemaining remainPrincipal, UserId userID ) { EconomicEvent = economicEvent ?? throw new ArgumentNullException("The economic event is required."); Id = economicEvent.Id; LoanAgreement = loanAgreement ?? throw new ArgumentNullException("The loan agreement is required."); LoanId = loanAgreement.Id; PaymentNumber = paymentNumber ?? throw new ArgumentNullException("The payment number is required."); PaymentDueDate = paymentDueDate ?? throw new ArgumentNullException("The payment due date is required."); LoanPrincipalAmount = principalAmount ?? throw new ArgumentNullException("The principal amount is required."); LoanInterestAmount = interestAmount ?? throw new ArgumentNullException("The interest amount is required."); LoanPrincipalRemaining = remainPrincipal ?? throw new ArgumentNullException("The balance remaining is required."); UserId = userID ?? throw new ArgumentNullException("The user id is required."); CheckValidity(); }
public void Should_detect_nominal_news() { var eEvnt = new EconomicEvent { Previous = "293" }; Assert.IsFalse(eEvnt.IsSpeechOrMeeting); }
public static void Delete(int identifier) { using (TradeProAssistantContext context = new TradeProAssistantContext()) { try { EconomicEvent economicevent = context.EconomicEvents.Find(identifier); context.Entry(economicevent).State = EntityState.Deleted; context.SaveChanges(); } catch { } } }
public static int Save(EconomicEvent economicevent) { using (TradeProAssistantContext context = new TradeProAssistantContext()) { context.Entry(economicevent).State = economicevent.IsNew ? EntityState.Added : EntityState.Modified; context.SaveChanges(); return(economicevent.Identifier); } }
public DividendPaymentRate ( EconomicEvent economicEvent, StockSubscription stockSubscription, DividendDeclarationDate dividendDeclarationDate, DividendPerShare dividendPerShare, UserId userID ) { EconomicEvent = economicEvent ?? throw new ArgumentNullException("The economic event is required."); StockSubscription = stockSubscription ?? throw new ArgumentNullException("The stock subscription is required."); StockId = stockSubscription.Id; DividendDeclarationDate = dividendDeclarationDate ?? throw new ArgumentNullException("The dividend declaration date is required."); DividendPerShare = dividendPerShare ?? throw new ArgumentNullException("The dividend per share is required."); UserId = userID ?? throw new ArgumentNullException("The stock issue date is required."); CheckValidity(); }
public StockSubscription ( EconomicEvent economicEvent, FinancierId financierId, StockIssueDate stockIssueDate, SharesIssured sharesIssured, PricePerShare pricePerShare, UserId userId ) { EconomicEvent = economicEvent ?? throw new ArgumentNullException("The economic event is required."); Id = economicEvent.Id; FinancierId = financierId ?? throw new ArgumentNullException("The financier id is required."); StockIssueDate = stockIssueDate ?? throw new ArgumentNullException("The stock issue date is required."); SharesIssured = sharesIssured ?? throw new ArgumentNullException("The shares issued amount is required."); PricePerShare = pricePerShare ?? throw new ArgumentNullException("The price per share is required."); UserId = userId ?? throw new ArgumentNullException("The id of the employee recording this stock subscription is required."); }
public void ShouldReturn_NewLoanAgreement() { var economicEvent = new EconomicEvent(Guid.NewGuid(), EventType.CashReceiptFromLoanAgreement); Financier financier = GetFinancier(); LoanAgreement agreement = new LoanAgreement ( economicEvent, FinancierId.Create(financier.Id), LoanAmount.Create(10000), InterestRate.Create(.006), LoanDate.Create(new DateTime(2020, 12, 31)), MaturityDate.Create(new DateTime(2021, 12, 31)), PaymentsPerYear.Create(12), UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744")) ); Assert.IsType <LoanAgreement>(agreement); }
public void ShouldRaiseError_DefaultLoanDate() { var economicEvent = new EconomicEvent(Guid.NewGuid(), EventType.CashReceiptFromLoanAgreement); Financier financier = GetFinancier(); Assert.Throws <ArgumentNullException>(() => { new LoanAgreement ( economicEvent, FinancierId.Create(financier.Id), LoanAmount.Create(10000), InterestRate.Create(.006), LoanDate.Create(new DateTime()), MaturityDate.Create(new DateTime(2021, 12, 31)), PaymentsPerYear.Create(12), UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744")) ); }); }
public async Task ShouldInsert_DividendDeclaration_UsingStockSubscriptionAggregate() { StockSubscription stockSubscription = await _stockSubscriptionRepo.GetByIdAsync(new Guid("5997f125-bfca-4540-a144-01e444f6dc25")); EconomicEvent economicEvent = new EconomicEvent(Guid.NewGuid(), EventType.CashDisbursementForDividentPayment); await _stockSubscriptionRepo.AddEconomicEventAsync(economicEvent); DividendPaymentRate dividendPayment = new DividendPaymentRate ( economicEvent, stockSubscription, DividendDeclarationDate.Create(new DateTime(2021, 11, 22)), DividendPerShare.Create(.02M), UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744")) ); stockSubscription.AddDividendPaymentRate(dividendPayment); _stockSubscriptionRepo.Update(stockSubscription); await _unitOfWork.Commit(); DividendPaymentRate result = stockSubscription.DividendPaymentRates.FirstOrDefault(p => p.Id == dividendPayment.EconomicEvent.Id); Assert.NotNull(result); }
public LoanAgreement ( EconomicEvent economicEvent, FinancierId financierId, LoanAmount loanAmount, InterestRate interestRate, LoanDate loanDate, MaturityDate maturityDate, PaymentsPerYear paymentsPerYear, UserId userID ) { EconomicEvent = economicEvent ?? throw new ArgumentNullException("The economic event is required."); Id = economicEvent.Id; FinancierId = financierId; LoanAmount = loanAmount ?? throw new ArgumentNullException("The loan amount for this loan agreement is required."); InterestRate = interestRate ?? throw new ArgumentNullException("The interest rate is required; if zero then pass in 0."); LoanDate = loanDate ?? throw new ArgumentNullException("The loan agreement date is required."); MaturityDate = maturityDate ?? throw new ArgumentNullException("The loan maturity date is required."); PaymentsPerYear = paymentsPerYear ?? throw new ArgumentNullException("The number of loan payments per year is required."); UserId = userID ?? throw new ArgumentNullException("The id of the employee recording this loan agreement is required."); CheckValidity(); }
public static void Delete(EconomicEvent economicevent) { Delete(economicevent.Identifier); }
public void Should_detect_nominal_news() { var eEvnt = new EconomicEvent { Previous = "293"}; Assert.IsFalse(eEvnt.IsSpeechOrMeeting); }
public void ShouldReturn_ValidExternalAgent() { var result = new EconomicEvent(Guid.NewGuid(), EventType.CashReceiptFromLoanAgreement); Assert.IsType <EconomicEvent>(result); }