public void SutNotOrderIfSortingIsEmpty()
        {
            var context =
                new TestAppContext(new Sorting<Book>[0]);
            IBooksOrderer orderer = new BooksOrderer(context);
            var books = GetBooks();
            var result = orderer.Order(books);

            Assert.IsFalse(result.Any());
        }
 public void SutNotOrderIfSortingIsNull()
 {
     var context =
         new TestAppContext(null);
     IBooksOrderer orderer = new BooksOrderer(context);
     var books = GetBooks();
     try
     {
         var result = orderer.Order(books);
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.IsInstanceOfType(ex, typeof(OrdenationException));
     }
 }
        public void SutOrderByAuthorAscendingAndTitleDescending()
        {
            var context =
                new TestAppContext(new[]
                {
                    new Sorting<Book> {Column = c => c.AuthorName, Ascending = true},
                    new Sorting<Book> {Column = c => c.Title, Ascending = false}
                });
            IBooksOrderer orderer = new BooksOrderer(context);
            var books = GetBooks();
            var result = orderer.Order(books);

            Assert.IsNotNull(result);
            Assert.AreEqual("Java How to Program", result.ElementAt(0).Title);
            Assert.AreEqual("Internet & World Wide Web: How to Program", result.ElementAt(1).Title);
            Assert.AreEqual("Head First Design Patterns", result.ElementAt(2).Title);
            Assert.AreEqual("Patterns of Enterprise Application Architecture", result.ElementAt(3).Title);
        }