public void EBookRepository_OrderBooks_Alphabetic_Returns_Books_Ordered_By_Alphabetic_Order_Ascending() { var ebookRepository = new EBookRepository(new FileSystemFake(), new FileInfoFactoryFake()); var unorderedBookList = CreateBookObjects.GetUnorderedEBookList(); var expected = new List <EBook> { new EBook { Title = "Title1" }, new EBook { Title = "Title2" }, new EBook { Title = "Title3" }, new EBook { Title = "Title4" } }; var result = ebookRepository.OrderBooks(unorderedBookList, "alphabetic"); CollectionAssert.AreEqual(expected, result, new TitleComparer()); }
public void EBookRepository_OrderBooks_Created_Returns_Books_Ordered_By_Creation_Date_Ascending() { var ebookRepository = new EBookRepository(new FileSystemFake(), new FileInfoFactoryFake()); var unorderedBookList = CreateBookObjects.GetUnorderedEBookList().ToList(); var expected = unorderedBookList.OrderByDescending(x => x.CreatedDate); var result = ebookRepository.OrderBooks(unorderedBookList, "creation"); CollectionAssert.AreEqual(expected, result, new CreationDateComparer()); }