GetVentureById() public method

public GetVentureById ( string id ) : Venture
id string
return Gringotts.Domain.Venture
コード例 #1
0
        public void ShouldFetchMultipleSubscriptionsForVenture()
        {
            Investor investor1 = CreateInvestor("Joy", 9000);
            Investor investor2 = CreateInvestor("Roy", 6000);
            InvestorRepository investorRepository = new InvestorRepository(session);
            investorRepository.Save(investor1);
            investorRepository.Save(investor2);

            Venture venture = CreateVenture(8000, 1920, "Ace Ventura");
            VentureRepository ventureRepository = new VentureRepository(session);
            ventureRepository.Save(venture);

            Amount amount1 = new Amount(712);
            Amount amount2 = new Amount(423);

            Offer offer1 = new Offer(investor1, amount1, venture);
            Offer offer2 = new Offer(investor2, amount2, venture);
            OfferRepository offerRepository = new OfferRepository(session);
            offerRepository.Save(offer1);
            offerRepository.Save(offer2);

            session.Flush();
            session.Clear();

            Venture fetchedVenture = ventureRepository.GetVentureById(venture.Id);
            Assert.AreEqual(new Amount(1135), fetchedVenture.SubscribedAmount());
        }
コード例 #2
0
        public void ShouldFetchOffersForInvestorAndVenture()
        {
            Investor investor = CreateInvestor("Jagan", 4000);
            InvestorRepository investorRepository = new InvestorRepository(session);
            investorRepository.Save(investor);

            Venture venture = CreateVenture(2000, 400, "Ram Capitalists");
            VentureRepository ventureRepository = new VentureRepository(session);
            ventureRepository.Save(venture);

            Amount amount = new Amount(600);
            Offer offer = new Offer(investor, amount, venture);
            OfferRepository offerRepository = new OfferRepository(session);
            offerRepository.Save(offer);

            session.Flush();
            session.Evict(investor);
            session.Evict(venture);
            session.Evict(offer);

            Investor fetchedInvestor = investorRepository.GetInvestorById(investor.Id);
            Assert.AreEqual(amount, fetchedInvestor.OfferValue);

            Venture fetchedVenture = ventureRepository.GetVentureById(venture.Id);
            Assert.AreEqual(amount, fetchedVenture.SubscribedAmount());
        }