public Bond(BondCoupon coupon, decimal faceValue, Currency currency, DateTime issueDate, DateTime maturityDate) { Coupon = coupon; FaceValue = faceValue; IssueDate = issueDate; MaturityDate = maturityDate; Currency = currency; CurrencyId = currency.Id; }
public void SetCoupon(decimal amount, decimal rate) { if (rate < 0 || rate > 1) { throw new ValidationException("Rate cannot be smaller than 0 or larger than 1"); } if (amount <= 0) { throw new ValidationException("Amount cannot be negative"); } Coupon = new BondCoupon { Rate = rate, Amount = amount }; }