public void AddTransaction(Transaction tx) { if (_transactions.Count == 5) { throw new WireCardException("Can't add more than 5 transactions to a single function!"); } if (_transactions.Count > 0) { Type t = _transactions.First().GetType(); if (tx.GetType() != t) { throw new WireCardException("A single function can only contain transactions of the same type!"); } } if (!IsTransactionAcceptable(tx)) { throw new WireCardException("The specified transaction is invalid for this function type!"); } _transactions.Add(tx); }
protected virtual bool IsTransactionAcceptable(Transaction tx) { return true; }