GoBankrupt() public method

public GoBankrupt ( ) : void
return void
Esempio n. 1
0
        public void StartedVentureMayGoBankrupt()
        {
            var outlay = new Amount(40);
            var venture = new Venture(new Name("Ventura"), outlay, new Amount(1));
            var initialCorpus = new Amount(100);
            var investor = new Investor(new Name("Investor0"), initialCorpus);
            venture.AddOffer(investor, new Amount(50));
            venture.Start();

            venture.GoBankrupt();
            Assert.AreEqual(Venture.BANKRUPT_STATE, venture.State);
        }
Esempio n. 2
0
        public void ShouldNotGiveDividendsIfItIsBankrupt()
        {
            var outlay = new Amount(40);
            var venture = new Venture(new Name("Ventura"), outlay, new Amount(1));
            var initialCorpus = new Amount(100);
            var investor = new Investor(new Name("Investor0"), initialCorpus);
            venture.AddOffer(investor, new Amount(50));

            venture.Start();

            venture.GoBankrupt();

            Assert.Throws<InvalidOperationException>(()=> venture.HandOutDividends(new Amount(100)));
        }
Esempio n. 3
0
        public void ShouldUpdateInvestorPortfolioWhenVentureGoesBankrupt()
        {
            var outlay = new Amount(50);
            var venture = new Venture(new Name("Ventura"), outlay, new Amount(1));
            var initialCorpus = new Amount(100);
            var investor = new Investor(new Name("Investor0"), initialCorpus);
            var investmentAmount = new Amount(50);
            venture.AddOffer(investor, investmentAmount);

            venture.Start();
            var previousAmount = investor.PortfolioValue;

            venture.GoBankrupt();
            var currentAmount = investor.PortfolioValue;

            Assert.AreEqual(previousAmount-investmentAmount, currentAmount);
        }
Esempio n. 4
0
        public void ShouldCreateVentureEventWhenVentureGoesBankrupt()
        {
            var outlay = new Amount(50);
            var venture = new Venture(new Name("Ventura"), outlay, new Amount(1));
            var initialCorpus = new Amount(100);
            var investor = new Investor(new Name("Investor0"), initialCorpus);
            var investmentAmount = new Amount(50);
            venture.AddOffer(investor, investmentAmount);

            venture.Start();
            venture.GoBankrupt();

            VentureEvent ventureEventProposed = new VentureEvent(VentureEvent.PROPOSED, outlay);
            VentureEvent ventureEventStarted = new VentureEvent(VentureEvent.STARTED, outlay);
            VentureEvent ventureEventForBankruptcy = new VentureEvent(VentureEvent.BANKRUPT, outlay);

            VentureHistory ventureHistory = venture.GetVentureHistory();
            Assert.Contains(ventureEventProposed, ventureHistory.GetEvents());
            Assert.Contains(ventureEventStarted, ventureHistory.GetEvents());
            Assert.Contains(ventureEventForBankruptcy, ventureHistory.GetEvents());
        }