/// <summary>
        /// Tells if book is newer.
        /// </summary>
        /// <param name="bookToCheck">Book to check.</param>
        /// <returns>True if book is published later than in given year.</returns>
        /// <exception cref="ArgumentException">Thrown if book to check is null.</exception>
        public bool IsMatch(Book bookToCheck)
        {
            BookValidator.CheckOnNull(bookToCheck);
            if (bookToCheck.PublicationYear > this.year)
            {
                return(true);
            }

            return(false);
        }
        /// <summary>
        /// Tells if title contain substring.
        /// </summary>
        /// <param name="bookToCheck">Book to check.</param>
        /// <returns>True if if title contain substring, otherwise - null.</returns>
        /// <exception cref="ArgumentException">Thrown if book to check is null.</exception>
        public bool IsMatch(Book bookToCheck)
        {
            BookValidator.CheckOnNull(bookToCheck);
            if (bookToCheck.Name.ToLower().Contains(this.searchSubstring.ToLower()))
            {
                return(true);
            }

            return(false);
        }
예제 #3
0
 /// <summary>
 /// Method that returns the result of comparison of years.
 /// </summary>
 /// <param name="firstBook">First book.</param>
 /// <param name="secondBook">Second book.</param>
 /// <returns>Returns 0 of publication years are the same.
 /// Returns 1 if first book was published earlier than second. Otherwise it returns -1.</returns>
 public int Compare(Book firstBook, Book secondBook)
 {
     BookValidator.CheckOnNull(firstBook);
     BookValidator.CheckOnNull(secondBook);
     return(secondBook.AmountOfPages - firstBook.AmountOfPages);
 }
예제 #4
0
 public bool IsMatch(Book bookToCheck)
 {
     BookValidator.CheckOnNull(bookToCheck);
     return(bookToCheck.Isbn == this.isbn);
 }