Esempio n. 1
0
        public async Task ShouldInsert_StockSubscriptionAndDividendDeclaration_UsingStockSubscriptionAggregate()
        {
            StockSubscription stockSubscription = new StockSubscription
                                                  (
                new EconomicEvent(Guid.NewGuid(), EventType.CashReceiptFromStockSubscription),
                FinancierId.Create(new Guid("84164388-28ff-4b47-bd63-dd9326d32236")),
                StockIssueDate.Create(new DateTime(2021, 11, 9)),
                SharesIssured.Create(33333),
                PricePerShare.Create(.33M),
                UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744"))
                                                  );

            DividendPaymentRate dividendPayment = new DividendPaymentRate
                                                  (
                new EconomicEvent(Guid.NewGuid(), EventType.CashDisbursementForDividentPayment),
                stockSubscription,
                DividendDeclarationDate.Create(new DateTime(2021, 11, 22)),
                DividendPerShare.Create(.02M),
                UserId.Create(new Guid("660bb318-649e-470d-9d2b-693bfb0b2744"))
                                                  );

            stockSubscription.AddDividendPaymentRate(dividendPayment);
            await _stockSubscriptionRepo.AddAsync(stockSubscription);

            await _unitOfWork.Commit();

            var result = await _stockSubscriptionRepo.Exists(stockSubscription.Id);

            Assert.True(result);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates an instance of the EarningReports class
 /// </summary>
 public EarningReports()
 {
     BasicContinuousOperations    = new BasicContinuousOperations();
     BasicDiscontinuousOperations = new BasicDiscontinuousOperations();
     BasicExtraordinary           = new BasicExtraordinary();
     BasicAccountingChange        = new BasicAccountingChange();
     BasicEPS = new BasicEPS();
     DilutedContinuousOperations    = new DilutedContinuousOperations();
     DilutedDiscontinuousOperations = new DilutedDiscontinuousOperations();
     DilutedExtraordinary           = new DilutedExtraordinary();
     DilutedAccountingChange        = new DilutedAccountingChange();
     DilutedEPS                          = new DilutedEPS();
     BasicAverageShares                  = new BasicAverageShares();
     DilutedAverageShares                = new DilutedAverageShares();
     DividendPerShare                    = new DividendPerShare();
     BasicEPSOtherGainsLosses            = new BasicEPSOtherGainsLosses();
     ContinuingAndDiscontinuedBasicEPS   = new ContinuingAndDiscontinuedBasicEPS();
     TaxLossCarryforwardBasicEPS         = new TaxLossCarryforwardBasicEPS();
     DilutedEPSOtherGainsLosses          = new DilutedEPSOtherGainsLosses();
     ContinuingAndDiscontinuedDilutedEPS = new ContinuingAndDiscontinuedDilutedEPS();
     TaxLossCarryforwardDilutedEPS       = new TaxLossCarryforwardDilutedEPS();
     NormalizedBasicEPS                  = new NormalizedBasicEPS();
     NormalizedDilutedEPS                = new NormalizedDilutedEPS();
     TotalDividendPerShare               = new TotalDividendPerShare();
     ReportedNormalizedBasicEPS          = new ReportedNormalizedBasicEPS();
     ReportedNormalizedDilutedEPS        = new ReportedNormalizedDilutedEPS();
     DividendCoverageRatio               = new DividendCoverageRatio();
 }
Esempio n. 3
0
 public void Configure(EntityTypeBuilder <DividendPaymentRate> entity)
 {
     entity.ToTable("DividendPymtRates", schema: "Finance");
     entity.HasKey(e => e.Id);
     entity.Property(p => p.Id).HasColumnType("UNIQUEIDENTIFIER").HasColumnName("DividendId");
     entity.HasOne(p => p.EconomicEvent).WithOne().HasForeignKey <DividendPaymentRate>(p => p.Id);
     entity.HasOne(p => p.StockSubscription).WithMany(p => p.DividendPaymentRates).HasForeignKey(p => p.StockId);
     entity.Property(p => p.StockId)
     .HasColumnType("UNIQUEIDENTIFIER")
     .HasColumnName("StockId")
     .IsRequired();
     entity.Property(p => p.DividendDeclarationDate)
     .HasConversion(p => p.Value, p => DividendDeclarationDate.Create(p))
     .HasColumnType("DATETIME2(0)")
     .HasColumnName("DividendDeclarationDate")
     .IsRequired();
     entity.Property(p => p.DividendPerShare)
     .HasConversion(p => p.Value, p => DividendPerShare.Create(p))
     .HasColumnType("DECIMAL(18,2)")
     .HasColumnName("DividendPerShare")
     .IsRequired();
     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)");
 }
Esempio n. 4
0
 /// <summary>
 /// Sets values for non existing periods from a previous instance
 /// </summary>
 /// <remarks>Used to fill-forward values from previous dates</remarks>
 /// <param name="previous">The previous instance</param>
 public void UpdateValues(EarningReports previous)
 {
     BasicContinuousOperations.UpdateValues(previous.BasicContinuousOperations);
     BasicDiscontinuousOperations.UpdateValues(previous.BasicDiscontinuousOperations);
     BasicExtraordinary.UpdateValues(previous.BasicExtraordinary);
     BasicAccountingChange.UpdateValues(previous.BasicAccountingChange);
     BasicEPS.UpdateValues(previous.BasicEPS);
     DilutedContinuousOperations.UpdateValues(previous.DilutedContinuousOperations);
     DilutedDiscontinuousOperations.UpdateValues(previous.DilutedDiscontinuousOperations);
     DilutedExtraordinary.UpdateValues(previous.DilutedExtraordinary);
     DilutedAccountingChange.UpdateValues(previous.DilutedAccountingChange);
     DilutedEPS.UpdateValues(previous.DilutedEPS);
     BasicAverageShares.UpdateValues(previous.BasicAverageShares);
     DilutedAverageShares.UpdateValues(previous.DilutedAverageShares);
     DividendPerShare.UpdateValues(previous.DividendPerShare);
     BasicEPSOtherGainsLosses.UpdateValues(previous.BasicEPSOtherGainsLosses);
     ContinuingAndDiscontinuedBasicEPS.UpdateValues(previous.ContinuingAndDiscontinuedBasicEPS);
     TaxLossCarryforwardBasicEPS.UpdateValues(previous.TaxLossCarryforwardBasicEPS);
     DilutedEPSOtherGainsLosses.UpdateValues(previous.DilutedEPSOtherGainsLosses);
     ContinuingAndDiscontinuedDilutedEPS.UpdateValues(previous.ContinuingAndDiscontinuedDilutedEPS);
     TaxLossCarryforwardDilutedEPS.UpdateValues(previous.TaxLossCarryforwardDilutedEPS);
     NormalizedBasicEPS.UpdateValues(previous.NormalizedBasicEPS);
     NormalizedDilutedEPS.UpdateValues(previous.NormalizedDilutedEPS);
     TotalDividendPerShare.UpdateValues(previous.TotalDividendPerShare);
 }
Esempio n. 5
0
        /// <summary>
        /// Applies updated values from <paramref name="update"/> to this instance
        /// </summary>
        /// <remarks>Used to apply data updates to the current instance. This WILL overwrite existing values. Default update values are ignored.</remarks>
        /// <param name="update">The next data update for this instance</param>
        public void UpdateValues(EarningReports update)
        {
            if (update == null)
            {
                return;
            }

            if (update.PeriodEndingDate != default(DateTime))
            {
                PeriodEndingDate = update.PeriodEndingDate;
            }
            if (update.FileDate != default(DateTime))
            {
                FileDate = update.FileDate;
            }
            if (!string.IsNullOrWhiteSpace(update.AccessionNumber))
            {
                AccessionNumber = update.AccessionNumber;
            }
            if (!string.IsNullOrWhiteSpace(update.FormType))
            {
                FormType = update.FormType;
            }
            BasicContinuousOperations?.UpdateValues(update.BasicContinuousOperations);
            BasicDiscontinuousOperations?.UpdateValues(update.BasicDiscontinuousOperations);
            BasicExtraordinary?.UpdateValues(update.BasicExtraordinary);
            BasicAccountingChange?.UpdateValues(update.BasicAccountingChange);
            BasicEPS?.UpdateValues(update.BasicEPS);
            DilutedContinuousOperations?.UpdateValues(update.DilutedContinuousOperations);
            DilutedDiscontinuousOperations?.UpdateValues(update.DilutedDiscontinuousOperations);
            DilutedExtraordinary?.UpdateValues(update.DilutedExtraordinary);
            DilutedAccountingChange?.UpdateValues(update.DilutedAccountingChange);
            DilutedEPS?.UpdateValues(update.DilutedEPS);
            BasicAverageShares?.UpdateValues(update.BasicAverageShares);
            DilutedAverageShares?.UpdateValues(update.DilutedAverageShares);
            DividendPerShare?.UpdateValues(update.DividendPerShare);
            BasicEPSOtherGainsLosses?.UpdateValues(update.BasicEPSOtherGainsLosses);
            ContinuingAndDiscontinuedBasicEPS?.UpdateValues(update.ContinuingAndDiscontinuedBasicEPS);
            TaxLossCarryforwardBasicEPS?.UpdateValues(update.TaxLossCarryforwardBasicEPS);
            DilutedEPSOtherGainsLosses?.UpdateValues(update.DilutedEPSOtherGainsLosses);
            ContinuingAndDiscontinuedDilutedEPS?.UpdateValues(update.ContinuingAndDiscontinuedDilutedEPS);
            TaxLossCarryforwardDilutedEPS?.UpdateValues(update.TaxLossCarryforwardDilutedEPS);
            NormalizedBasicEPS?.UpdateValues(update.NormalizedBasicEPS);
            NormalizedDilutedEPS?.UpdateValues(update.NormalizedDilutedEPS);
            TotalDividendPerShare?.UpdateValues(update.TotalDividendPerShare);
            ReportedNormalizedBasicEPS?.UpdateValues(update.ReportedNormalizedBasicEPS);
            ReportedNormalizedDilutedEPS?.UpdateValues(update.ReportedNormalizedDilutedEPS);
            DividendCoverageRatio?.UpdateValues(update.DividendCoverageRatio);
            if (!string.IsNullOrWhiteSpace(update.PeriodType))
            {
                PeriodType = update.PeriodType;
            }
        }
Esempio n. 6
0
        public async Task ShouldUpdate_DividendDeclaration_UsingStockSubscriptionAggregate()
        {
            StockSubscription stockSubscription = await _stockSubscriptionRepo.GetByIdAsync(new Guid("264632b4-20bd-473f-9a9b-dd6f3b6ddbac"));

            DividendPaymentRate dividendPayment = stockSubscription.DividendPaymentRates.FirstOrDefault(p => p.Id == new Guid("24d6936a-beb5-451b-a950-0f30e3ad463d"));

            dividendPayment.UpdateDividendDeclarationDate(DividendDeclarationDate.Create(new DateTime(2021, 3, 16)));
            dividendPayment.UpdateDividendPerShare(DividendPerShare.Create(.035M));

            stockSubscription.UpdateDividendPaymentRate(dividendPayment);
            await _unitOfWork.Commit();

            DividendPaymentRate result = stockSubscription.DividendPaymentRates.FirstOrDefault(p => p.Id == new Guid("24d6936a-beb5-451b-a950-0f30e3ad463d"));

            Assert.Equal(new DateTime(2021, 3, 16), result.DividendDeclarationDate);
            Assert.Equal(.035M, result.DividendPerShare);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        /// <summary>
        /// Sets values for non existing periods from a previous instance
        /// </summary>
        /// <remarks>Used to fill-forward values from previous dates</remarks>
        /// <param name="previous">The previous instance</param>
        public void UpdateValues(EarningReports previous)
        {
            if (previous == null)
            {
                return;
            }

            if (BasicContinuousOperations != null)
            {
                BasicContinuousOperations.UpdateValues(previous.BasicContinuousOperations);
            }
            if (BasicDiscontinuousOperations != null)
            {
                BasicDiscontinuousOperations.UpdateValues(previous.BasicDiscontinuousOperations);
            }
            if (BasicExtraordinary != null)
            {
                BasicExtraordinary.UpdateValues(previous.BasicExtraordinary);
            }
            if (BasicAccountingChange != null)
            {
                BasicAccountingChange.UpdateValues(previous.BasicAccountingChange);
            }
            if (BasicEPS != null)
            {
                BasicEPS.UpdateValues(previous.BasicEPS);
            }
            if (DilutedContinuousOperations != null)
            {
                DilutedContinuousOperations.UpdateValues(previous.DilutedContinuousOperations);
            }
            if (DilutedDiscontinuousOperations != null)
            {
                DilutedDiscontinuousOperations.UpdateValues(previous.DilutedDiscontinuousOperations);
            }
            if (DilutedExtraordinary != null)
            {
                DilutedExtraordinary.UpdateValues(previous.DilutedExtraordinary);
            }
            if (DilutedAccountingChange != null)
            {
                DilutedAccountingChange.UpdateValues(previous.DilutedAccountingChange);
            }
            if (DilutedEPS != null)
            {
                DilutedEPS.UpdateValues(previous.DilutedEPS);
            }
            if (BasicAverageShares != null)
            {
                BasicAverageShares.UpdateValues(previous.BasicAverageShares);
            }
            if (DilutedAverageShares != null)
            {
                DilutedAverageShares.UpdateValues(previous.DilutedAverageShares);
            }
            if (DividendPerShare != null)
            {
                DividendPerShare.UpdateValues(previous.DividendPerShare);
            }
            if (BasicEPSOtherGainsLosses != null)
            {
                BasicEPSOtherGainsLosses.UpdateValues(previous.BasicEPSOtherGainsLosses);
            }
            if (ContinuingAndDiscontinuedBasicEPS != null)
            {
                ContinuingAndDiscontinuedBasicEPS.UpdateValues(previous.ContinuingAndDiscontinuedBasicEPS);
            }
            if (TaxLossCarryforwardBasicEPS != null)
            {
                TaxLossCarryforwardBasicEPS.UpdateValues(previous.TaxLossCarryforwardBasicEPS);
            }
            if (DilutedEPSOtherGainsLosses != null)
            {
                DilutedEPSOtherGainsLosses.UpdateValues(previous.DilutedEPSOtherGainsLosses);
            }
            if (ContinuingAndDiscontinuedDilutedEPS != null)
            {
                ContinuingAndDiscontinuedDilutedEPS.UpdateValues(previous.ContinuingAndDiscontinuedDilutedEPS);
            }
            if (TaxLossCarryforwardDilutedEPS != null)
            {
                TaxLossCarryforwardDilutedEPS.UpdateValues(previous.TaxLossCarryforwardDilutedEPS);
            }
            if (NormalizedBasicEPS != null)
            {
                NormalizedBasicEPS.UpdateValues(previous.NormalizedBasicEPS);
            }
            if (NormalizedDilutedEPS != null)
            {
                NormalizedDilutedEPS.UpdateValues(previous.NormalizedDilutedEPS);
            }
            if (TotalDividendPerShare != null)
            {
                TotalDividendPerShare.UpdateValues(previous.TotalDividendPerShare);
            }
            if (ReportedNormalizedBasicEPS != null)
            {
                ReportedNormalizedBasicEPS.UpdateValues(previous.ReportedNormalizedBasicEPS);
            }
            if (ReportedNormalizedDilutedEPS != null)
            {
                ReportedNormalizedDilutedEPS.UpdateValues(previous.ReportedNormalizedDilutedEPS);
            }
            if (DividendCoverageRatio != null)
            {
                DividendCoverageRatio.UpdateValues(previous.DividendCoverageRatio);
            }
        }