public async Task GivenNullParameterPassed_WhenReOrderCalled_ReturnBadRequest()
        {
            PDFLibraryController controller = GetController();

            var reOrderList = GetListOf2PdfFileListItems().Select(pdf => pdf.Name).ToList();

            var result = await controller.Put(null);

            Assert.IsInstanceOf <BadRequestObjectResult>(result);

            _mockStorage.Verify(s => s.ReOrder(It.IsAny <List <string> >()), Times.Never);
        }
        public async Task GivenPdfsInStore_WhenReOrderCalled_ReOrder()
        {
            PDFLibraryController controller = GetController();

            var reOrderList = GetListOf2PdfFileListItems().Select(pdf => pdf.Name).ToList();

            _mockStorage.Setup(s => s.ReOrder(reOrderList)).
            Returns(Task.Factory.StartNew(() => false));

            var result = await controller.Put(reOrderList);

            Assert.IsInstanceOf <OkResult>(result);

            _mockStorage.Verify(s => s.ReOrder(reOrderList), Times.Once);
        }
        public void GivenStoreThrows_WhenReOrderCalled_ReturnReThrow()
        {
            PDFLibraryController controller = GetController();

            var reOrderList = GetListOf2PdfFileListItems().Select(pdf => pdf.Name).ToList();

            var thrown = new Exception();

            _mockStorage.Setup(s => s.ReOrder(reOrderList)).Throws(thrown);

            var ex = Assert.Throws <AggregateException>(() =>
            {
                var ret = controller.Put(reOrderList).Result;
            });

            Assert.AreEqual(thrown, ex.InnerException);
        }