Apply() public method

public Apply ( Amount amount ) : Amount
amount Amount
return Amount
Exemplo n.º 1
0
 public void ShouldBeAbleToApplyPercentage()
 {
     var percentage = new Percentage(0.4f);
     Assert.AreEqual(new Amount(40.0f), percentage.Apply(new Amount(100)));
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 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;
 }