public AddOffer ( |
||
investor | ||
investedAmount | ||
리턴 |
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;
}
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))); }