/// <summary> /// Gets user input for new book to add to the Library. /// </summary> private static void AddNewBookToLibrary() { Console.Write("Enter the new book's title: "); string title = Console.ReadLine(); Console.Write("Enter the book's author's first name: "); string firstName = Console.ReadLine(); Console.Write("Enter the book's author's last name: "); string lastName = Console.ReadLine(); Author author = new Author(firstName, lastName); Book newBook; Console.WriteLine("Would you like to the new book a genre? (y/n)"); string addGenre = Console.ReadLine(); if (addGenre.ToLower() == "y" || addGenre.ToLower() == "yes") { Book.BookGenres genre = ChooseGenre(); newBook = new Book(title, author, genre); } else { newBook = new Book(title, author); } Library.Add(newBook); }
public void CanSetAndGetBookProperities() { //Arrange Author firstAuthor = new Author("Kazuo", "Ishiguro"); Book testBook = new Book("The Remains of the Day", firstAuthor); string expectedTitle = "The Tin Drum"; Author expectedAuthor = new Author("Gunter", "Grass"); Book.BookGenres expectedGenre = Book.BookGenres.SelfHelp; //Act testBook.Title = expectedTitle; testBook.Author = expectedAuthor; testBook.Genre = Book.BookGenres.SelfHelp; //Assert Assert.Equal(expectedTitle, testBook.Title); Assert.Equal(expectedAuthor, testBook.Author); Assert.Equal(expectedGenre, testBook.Genre); }