HandOutDividends() public method

public HandOutDividends ( Amount dividend ) : void
dividend Amount
return void
Esempio n. 1
0
        public void ShouldCreateDividendReceivedEventWhenDividendIsDeclared()
        {
            var initialBalance = new Amount(1000);
            var investor1 = new Investor(new Name("Inverstor 1"), initialBalance);

            var outlay = new Amount(400);
            var venture = new Venture(new Name("Ventura Inc."), outlay, new Amount(1));

            venture.AddOffer(investor1, outlay);

            venture.Start();
            var dividend = new Amount(1000);
            venture.HandOutDividends(dividend);

            BalanceHistory history = investor1.GetBalanceHistory();
            string dividendEvent = string.Format(BalanceEvent.DIVIDEND_RECEIVED, venture.Name);
            BalanceEvent balanceEvent = new BalanceEvent(dividendEvent, initialBalance - outlay + dividend);
            Assert.Contains(balanceEvent, history.GetEvents());
        }
Esempio n. 2
0
        public void ShouldBeAbleToHandOutDividends()
        {
            var venture = new Venture(new Name("Venture"), new Amount(1000), new Amount(1));
            var quarterInvestor = new Investor(new Name("investor"), new Amount(1000));
            var threeFourthsInvestor = new Investor(new Name("investor"), new Amount(1000));
            var dividend = new Amount(1000);

            venture.AddOffer(quarterInvestor, new Amount(250));
            venture.AddOffer(threeFourthsInvestor, new Amount(750));

            venture.Start();

            venture.HandOutDividends(dividend);
        }
Esempio n. 3
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. 4
0
 public void ShouldNotBeAbleToDivideDividendsUnlessInAStartedState()
 {
     var dividend = new Amount(1000);
     var venture = new Venture(new Name("Ventura"), new Amount(100), new Amount(1));
     Assert.Throws<Exception>(delegate { venture.HandOutDividends(dividend); });
     venture.ChangeStateToCancelled();
     Assert.Throws<Exception>(delegate { venture.HandOutDividends(dividend); });
     venture.ChangeStateToStarted();
     Assert.DoesNotThrow(delegate { venture.HandOutDividends(dividend); });
 }
Esempio n. 5
0
 public void Should_Not_Be_Able_To_Divide_Dividends_Unless_In_A_Started_State()
 {
     Amount dividend = new Amount(1000);
     Venture venture = new Venture(new Name("Ventura"), new Amount(100), new Amount(1));
     Assert.Throws<Exception>(delegate { venture.HandOutDividends(dividend); });
     venture.ChangeStateToCancelled();
     Assert.Throws<Exception>(delegate { venture.HandOutDividends(dividend); });
     venture.ChangeStateToStarted();
     Assert.DoesNotThrow(delegate { venture.HandOutDividends(dividend); });
 }
Esempio n. 6
0
        public void Should_Be_Able_To_Hand_Out_Dividends()
        {
            Venture venture = new Venture(new Name("Venture"), new Amount(1000), new Amount(1));
            Investor quarterInvestor = new Investor(new Name("investor"), new GringottsDate(DateTime.Now), new Amount(1000));
            Investor threeFourthsInvestor = new Investor(new Name("investor"), new GringottsDate(DateTime.Now), new Amount(1000));
            Amount dividend = new Amount(1000);

            venture.AddOffer(quarterInvestor, new Amount(250));
            venture.AddOffer(threeFourthsInvestor, new Amount(750));

            venture.Start();

            venture.HandOutDividends(dividend);
        }