Gringotts.Domain.Venture.AddOffer C# (CSharp) Method

AddOffer() public method

public AddOffer ( Investor investor, Amount investedAmount ) : Offer
investor Investor
investedAmount Amount
return Offer
        public virtual Offer AddOffer(Investor investor, Amount investedAmount)
        {
            if (Subscription.AlreadyInvested(investor))
                throw new InvalidOfferException("Cannot invest more than once.");
            if (!MinimumInvestment(investedAmount))
                throw new InvalidOfferException("Investment amount less than the required minimum amount.");
            Offer offer = new Offer(investor, investedAmount, this);
            investor.AcceptOffer(offer);
            Subscription.Add(offer);
            return offer;
        }

Usage Example

Exemplo n.º 1
0
 public void ShouldAllowInvestorToInvestOnlyOnce()
 {
     var venture = new Venture(new Name("Ventura"), new Amount(100), new Amount(1));
     var investor = new Investor(new Name("investor"),  new Amount(50000));
     var duplicateInvestor = new Investor(new Name("investor"),  new Amount(500));
     venture.AddOffer(investor, new Amount(2));
     Assert.Throws<InvalidOfferException>(() => venture.AddOffer(duplicateInvestor, new Amount(2)));
 }
All Usage Examples Of Gringotts.Domain.Venture::AddOffer