public void ShouldBeAbleToApplyPercentage() { var percentage = new Percentage(0.4f); Assert.AreEqual(new Amount(40.0f), percentage.Apply(new Amount(100))); }
public void ShouldSplitOutlayMoneyAccordingToRatio() { var venture = new Venture(new Name("venture-name"), new Amount(100), new Amount(10)); var firstVentureName = new Name("new-venture-1"); var secondVentureName = new Name("new-venture-2"); var percentage = new Percentage(0.2f); var terms = new TermsOfSplit(percentage, firstVentureName, secondVentureName); venture.AddOffer(new Investor(new Name("testName"), new Amount(1000)), new Amount(100)); venture.Start(); var ventures = venture.Split(terms); Assert.AreEqual(percentage.Apply(venture.Outlay), ventures.First().Outlay); Assert.AreEqual(percentage.ApplyRemaining(venture.Outlay), ventures.Last().Outlay); }
private Holding GetSplittedHolding(Percentage percentage) { var aHolding = new Holding(); foreach (var investment in Investments) { Investment inv = new Investment(investment.Investor, percentage.Apply(investment.Value)); aHolding.Add(inv); inv.Investor.AddInvestmentToPortfolio(inv); } return aHolding; }