public void Should_Be_Able_Save()
 {
     Investment investment =
         new Investment(new Investor(new Name("Investor"), new GringottsDate(DateTime.Now), new Amount(6000)),
                         new Venture(new Name("Venture"), new Amount(5000), new Amount(1250)), new Amount(400));
     Assert.AreEqual("expected", "actual");
 }
Ejemplo n.º 2
0
 public void ShouldBeAbleToCreateInvestmentFromOffer()
 {
     var offer = new Offer(
         new Investor(new Name("Investor1"), new Amount(500)), new Amount(300),
         null);
     var investment =
         new Investment(new Investor(new Name("Investor1"), new Amount(500)),
                        null, new Amount(300));
     Assert.AreEqual(investment, offer.ToInvestment());
 }
Ejemplo n.º 3
0
        public void Should_Be_Able_To_Give_Returns()
        {
            Amount corpus = new Amount(1000);
            Amount offer = new Amount(250);
            Amount dividend = new Amount(50);
            Investor investor = new Investor(new Name("Dummy"), new GringottsDate(DateTime.Now), corpus);

            Investment investment = new Investment(investor, null, offer);
            investment.GiveReturn(dividend);
            Assert.AreEqual(corpus + dividend, investor.Corpus);
        }
        public void Should_Persist()
        {
            Investor investor = new Investor(new Name("Investor 1"), new GringottsDate(DateTime.Today), new Amount(100));
            InvestorRepository investorRepository = new InvestorRepository();
            investorRepository.Session = session;
            investorRepository.Save(investor);

            Venture venture = new Venture(new Name("Ventura"), new Amount(100), new Amount(1));
            VentureRepository ventureRepository = new VentureRepository(session);
            ventureRepository.Save(venture);

            Investment investment = new Investment(investor, venture, new Amount(10));
            InvestmentRepository investmentRepository = new InvestmentRepository(session);
            investmentRepository.Save(investment);

            IList<Investment> investments = investmentRepository.FetchAll();
            Assert.Greater(investments.Count, 0);
        }
Ejemplo n.º 5
0
 public void AddInvestment(Investment investment)
 {
     investments.Add(investment);
 }
Ejemplo n.º 6
0
 public void RemoveInvestment(Investment investment)
 {
     investments.Remove(investment);
 }
Ejemplo n.º 7
0
 public void Save(Investment investment)
 {
     Session.Save(investment);
 }
Ejemplo n.º 8
0
 public virtual void AddInvestmentToPortfolio(Investment investment)
 {
     portfolio.AddInvestment(investment);
 }
Ejemplo n.º 9
0
 public void Should_Be_Able_To_Create_Investment_From_Offer()
 {
     Offer offer = new Offer(new Investor(new Name("Investor1"), new GringottsDate(DateTime.Now), new Amount(500)), new Amount(300), null);
     Investment investment = new Investment(new Investor(new Name("Investor1"), new GringottsDate(DateTime.Now), new Amount(500)), null, new Amount(300));
     Assert.AreEqual(investment, offer.ToInvestment());
 }
Ejemplo n.º 10
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;
 }