Ejemplo n.º 1
0
 public virtual bool Equals(VentureEvent other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.EventType, EventType) && Equals(other.Outlay, Outlay);
 }
Ejemplo n.º 2
0
 public void AddEvent(VentureEvent ventureEvent)
 {
     events.Add(ventureEvent);
 }
Ejemplo n.º 3
0
        public void ShouldCreateVentureEventWhenVentureSplits()
        {
            var outlay = new Amount(40);
            var venture = new Venture(new Name("Ventura"), outlay, new Amount(1));
            var investor0 = new Investor(new Name("Investor0"), new Amount(100));
            venture.AddOffer(investor0, new Amount(50));
            venture.Start();
            var firstVentureName = new Name("new-venture-1");
            var secondVentureName = new Name("new-venture-2");
            var percentage = new Percentage(0.2f);

            var terms = new TermsOfSplit(percentage, firstVentureName, secondVentureName);
            var newVentures = venture.Split(terms);

            Assert.IsTrue(newVentures.First().IsStarted());
            Assert.IsTrue(newVentures.Last().IsStarted());

            VentureEvent ventureEventSplit1 = new VentureEvent(VentureEvent.SPLIT,new Amount(8));
            VentureEvent ventureEventStarted1 = new VentureEvent(VentureEvent.STARTED,new Amount(8));
            VentureEvent ventureEventSplit2 = new VentureEvent(VentureEvent.SPLIT,new Amount(32));
            VentureEvent ventureEventStarted2 = new VentureEvent(VentureEvent.STARTED,new Amount(32));

            VentureHistory ventureHistory1 = newVentures.First().GetVentureHistory();
            VentureHistory ventureHistory2 = newVentures.Last().GetVentureHistory();

            Assert.Contains(ventureEventSplit1, ventureHistory1.GetEvents());
            Assert.Contains(ventureEventStarted1, ventureHistory1.GetEvents());

            Assert.Contains(ventureEventSplit2, ventureHistory2.GetEvents());
            Assert.Contains(ventureEventStarted2, ventureHistory2.GetEvents());
        }
Ejemplo n.º 4
0
        public void ShouldCreateVentureEventWhenVentureIsCancelled()
        {
            Venture venture = CreateVenture(600, 100, "Ace Ventura");
            Investor investor = CreateInvestor("Bull Investor", 10000);
            venture.AddOffer(investor, new Amount(600));
            venture.Start();
            venture.ChangeStateToCancelled();

            VentureEvent ventureEvent = new VentureEvent(VentureEvent.CANCELLED, new Amount(600));
            VentureHistory ventureHistory = venture.GetVentureHistory();
            Assert.Contains(ventureEvent, ventureHistory.GetEvents());
        }
Ejemplo n.º 5
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());
        }
Ejemplo n.º 6
0
        public void ShouldCreateAVentureEventWhenVentureIsProposed()
        {
            Venture venture = CreateVenture(500, 100, "Ace Ventura");

            VentureEvent ventureEvent = new VentureEvent(VentureEvent.PROPOSED,new Amount(500));
            VentureHistory ventureHistory = venture.GetVentureHistory();
            Assert.Contains(ventureEvent, ventureHistory.GetEvents());
        }