public void Save(ICashFlow cashFlow) { if (!this._cashFlowDb.ContainsKey(cashFlow.GenerateId())) { this._cashFlowDb.Add(cashFlow.GenerateId(), cashFlow); } this._cashFlowDb[cashFlow.GenerateId()] = cashFlow; }
public Activity(decimal cash, decimal debt, ICashFlow cashFlow, DateTime initiatedAt) { InitiatedAt = initiatedAt; InitialCash = cash; InitialDebt = debt; CashFlow = cashFlow; }
// private static Activity GetActivity(ICashFlow cashFlow, DateTime startAt) // { // var result = new Activity(cashFlow, startAt); // // return result; // } private static Activity BuyAndSellOneHouse(ICashFlow cashFlow, DateTime startAt, DateTime soldAt, decimal downPaymentRate) { var condoAppreciation = new CompoundYearlyInflation(0.05M); var soldPrice = new Money(500000, startAt) .GetValueAt(condoAppreciation, soldAt); return(new MagicEstateBuilder(cashFlow, startAt) .SetInitialCash(50000.00M) .AddCondoWithFixedRateMortgageAtDownPaymentPercentage("first", 500000, downPaymentRate) .SellHome("first", soldAt, soldPrice) .Build()); }
private static decimal PrintCashFlow(decimal downPaymentRate, ICashFlow cashFlow, DateTime startedAt, DateTime soldAt, decimal previousCash) { var activity = BuyAndSellOneHouse(cashFlow, startedAt, soldAt, downPaymentRate); var consumerPriceIndex = new CompoundYearlyInflation(0.02M); // var netWorth = activity.GetNetWorth(consumerPriceIndex, atTwentyYears.AddDays(1)); var cash = activity.GetCashAt(Inflations.NoopInflation, soldAt.AddDays(1)); var condoPurchase = activity.GetHistories() .Where(action => action.Type == Types.Purchase) .Where(action => action.Product.GetType() == typeof(Home)) .First(); Console.WriteLine($"\tPurchased with {downPaymentRate * 100} per cent down at {condoPurchase.At} after 20 years"); Console.WriteLine($"\t- Cash:\t\t{cash}"); if (previousCash != 0.00M) { Console.WriteLine($"\t- %+- Change:\t{((cash / previousCash) - 1).ToString("#0.00 %")}"); } return(cash); }
public CashFinder(ICashFlow cashFlow, DateTime initiatedAt) { CashFlow = cashFlow; InitiatedAt = initiatedAt; }
public RealEstateBuilder(ICashFlow cashFlow, DateTime at) { Result = new Activity(cashFlow, at); }
public Activity(ICashFlow cashFlow, DateTime initiatedAt) { CashFlow = cashFlow; InitiatedAt = initiatedAt; }
public MagicEstateBuilder(ICashFlow cashFlow, DateTime initiatedAt) { Result = new Activity(cashFlow, initiatedAt); InitiatedAt = At = initiatedAt; }
public void Save(ICashFlow cashFlow) { if (!this._cashFlowDb.ContainsKey(cashFlow.GenerateId())) this._cashFlowDb.Add(cashFlow.GenerateId(), cashFlow); this._cashFlowDb[cashFlow.GenerateId()] = cashFlow; }