public void VerifyOffsetIsCalculatedCorrectly() { var sim = new AllYearsSimulation(); var input = CreateInputData(); var result = sim.Run(CreateReturnData(), input, input.Adjustments); Assert.IsNotNull(result); foreach (var item in result[0].NewPortfolio.ComputedInvestments()) { Assert.AreEqual(result[result.Count - 1].NewPortfolio.ComputedInvestments()[item.Key], item.Value); } }
public void VerifyOffsetIsCalculatedCorrectlyWithExcessOffset() { var sim = new AllYearsSimulation(); var input = CreateInputData(); input.Adjustments.Clear(); input.Adjustments.Add(new AdjustByIncomeAndExpenses(input.IncomeAndExpenses)); input.Adjustments.Add(new AdjustByGlide("Equity", "Bond", 200)); input.Adjustments.Add(new AdjustIncomeByStockPerformance()); var result = sim.Run(CreateReturnData(), input, input.Adjustments); Assert.IsNotNull(result); Assert.AreEqual(100, result[0].NewPortfolio.ComputedInvestments().Sum(a => a.Value)); }
public void VerifyOffsetIsCalculatedCorrectlyWithExcessOffset() { var sim = new AllYearsSimulation(); var input = CreateInputData(); input.Adjustments.Clear(); input = AddAdjustments(new AdjustByMaxMinValues(new Dictionary <string, decimal>() { { "Bond", 120 }, { "Equity", 0 } }, null), input); var result = sim.Run(CreateReturnData(), input, input.Adjustments); Assert.IsNotNull(result); Assert.AreEqual(100, result[0].NewPortfolio.ComputedInvestments().Sum(a => a.Value)); }