Esempio n. 1
0
        /// <summary>
        /// Adds the book.
        /// </summary>
        /// <param name="book">The book.</param>
        /// <exception cref="ArgumentNullException">book</exception>
        /// <exception cref="ArgumentException">book</exception>
        public void AddBook(Book book)
        {
            if (ReferenceEquals(book, null))
            {
                Logger.Error($"{nameof(book)} is null");
                throw new ArgumentNullException($"{nameof(book)} is null");
            }

            if (BookList.Contains(book))
            {
                Logger.Error($"{nameof(book)} is already exist!");
                throw new ArgumentException($"{nameof(book)} is already exist!");
            }

            BookList.Add(book);
            Logger.Info($"{nameof(book)} added!");
        }