public void BookTable() { // Arrange BookController controller = new BookController( booksServiceMock.Object, pagesServiceMock.Object, pageConnectionsServiceMock.Object, usersServiceMock.Object ); Mock <IDataTablesRequest> dtRequestMock = new Mock <IDataTablesRequest>(); var list = new List <Book>() { new Book() { Author = new User() } }; // Act dtRequestMock.Setup(x => x.Search).Returns(new Search(string.Empty, false)); booksServiceMock.Setup(x => x.GetAllAndDeleted()).Returns(list.AsQueryable); dtRequestMock.Setup(x => x.Columns).Returns(new ColumnCollection(new List <Column>() { new Column("", "", true, true, "", false) })); ActionResult result = controller.BookTable(dtRequestMock.Object) as ActionResult; // Assert Assert.IsNotNull(result); }