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); }
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))); }
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); }
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()); }