Exemple #1
0
        public Borrowing(int id, Magazine magazine, Friend friend, DateTime borrowingDate)
        {
            if (!IsValidMagazine(magazine))
            {
                throw new ArgumentException("Magazine property cannot be set instantiated as a null value.");
            }
            if (!isValidFriend(friend))
            {
                throw new ArgumentException("Friend property cannot be set instantiated as a null value.");
            }
            if (!IsValidDateTime(borrowingDate))
            {
                throw new ArgumentException("BorrowingDate property cannot be set as a date from the future.");
            }

            this.id            = id;
            this.magazine      = magazine;
            this.friend        = friend;
            this.borrowingDate = borrowingDate;
        }
Exemple #2
0
 private bool IsValidMagazine(Magazine magazine)
 {
     return(magazine != null);
 }