コード例 #1
0
 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");
 }
コード例 #2
0
ファイル: OfferTest.cs プロジェクト: bagheera/Gringotts
 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());
 }
コード例 #3
0
ファイル: InvestmentTest.cs プロジェクト: jskswamy/Gringotts
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: Portfolio.cs プロジェクト: jskswamy/Gringotts
 public void AddInvestment(Investment investment)
 {
     investments.Add(investment);
 }
コード例 #6
0
ファイル: Portfolio.cs プロジェクト: bagheera/Gringotts
 public void RemoveInvestment(Investment investment)
 {
     investments.Remove(investment);
 }
コード例 #7
0
 public void Save(Investment investment)
 {
     Session.Save(investment);
 }
コード例 #8
0
ファイル: Investor.cs プロジェクト: jskswamy/Gringotts
 public virtual void AddInvestmentToPortfolio(Investment investment)
 {
     portfolio.AddInvestment(investment);
 }
コード例 #9
0
ファイル: OfferTest.cs プロジェクト: jskswamy/Gringotts
 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());
 }
コード例 #10
0
ファイル: Holding.cs プロジェクト: bagheera/Gringotts
 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;
 }