public void getAllAuthorBooks()
        {
            var result = BookStoreFunctions.GetAllAuthorBooks("Polo");

            Assert.True(result[0].BookTitle == "The Travels of Marco Polo");
        }
Exemple #2
0
        public static void AreArguementsValid(string[] args)
        {
            var ohTypeTemp = args[1].ToLower();
            var findByTemp = args[2].ToLower();

            if (ohTypeTemp == "csv" || ohTypeTemp == "console")
            {
                ohType = ohTypeTemp;
                if (findByTemp == "title" || findByTemp == "author" || findByTemp == "all")
                {
                    findBy = findByTemp;
                    switch (findBy)
                    {
                    case "title":
                    {
                        var title = args.ToList();
                        title.RemoveRange(0, 3);
                        var titleStr = string.Join(" ", title.ToArray());
                        Console.WriteLine(titleStr);
                        if (titleStr == "The Travels of Marco Polo" || titleStr == "Canterbury Tales")
                        {
                            book = BookStoreFunctions.GetBookByTitle(titleStr);
                        }
                        else
                        {
                            Console.WriteLine("The Travels of Marco Polo or Canterbury Tales");
                        }
                        break;
                    }

                    case "author":
                    {
                        var author = args[3].ToLower();
                        if (author == "polo" || author == "chaucer")
                        {
                            books = BookStoreFunctions.GetAllAuthorBooks(author);
                        }
                        else
                        {
                            Console.WriteLine("Polo or Chaucer");
                        }
                        break;
                    }

                    case "all":
                    {
                        books = BookStoreFunctions.GetAllBooks();
                        break;
                    }
                    }
                }
                else
                {
                    Console.WriteLine("Search by all, title, or author");
                }
            }
            else
            {
                Console.WriteLine("Recieve books by Console or Csv");
            }
        }