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");
 }
Esempio 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());
 }
Esempio 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);
        }
Esempio n. 5
0
 public void AddInvestment(Investment investment)
 {
     investments.Add(investment);
 }
Esempio n. 6
0
 public void RemoveInvestment(Investment investment)
 {
     investments.Remove(investment);
 }
Esempio n. 7
0
 public void Save(Investment investment)
 {
     Session.Save(investment);
 }
Esempio n. 8
0
 public virtual void AddInvestmentToPortfolio(Investment investment)
 {
     portfolio.AddInvestment(investment);
 }
Esempio 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());
 }
Esempio 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;
 }