public async Task Find_Objects_in_Collection(string collectionName, string findExpression, int start, int limit, int expectedCount) { var controller = new ObjectController(_fixture.MongoRepository); var items = new List <string>() { "{ 'title': 'The Red Badge of Courage', 'author': 'Stephen Crane', 'pages': 112, 'isbn': { 'isbn-10' : '0486264653', 'isbn-13' : '978-0486264653' } }", "{ 'title': 'Don Quixote', 'author': 'Miguel De Cervantes', 'pages': 992, 'isbn': { 'isbn-10' : '0060934344', 'isbn-13' : '978-0060934347' } }", "{ 'title': 'The Grapes of Wrath', 'author': 'John Steinbeck', 'pages': 464, 'isbn': { 'isbn-10' : '0143039431', 'isbn-13' : '978-0143039433' } }", "{ 'title': 'The Catcher in the Rye', 'author': 'J. D. Salinger', 'pages': 288, 'isbn': { 'isbn-10' : '9780316769174', 'isbn-13' : '978-0316769174' } }", "{ 'title': 'Slaughterhouse-Five', 'author': 'Kurt Vonnegut', 'pages': 288, 'isbn': { 'isbn-10' : '0812988523', 'isbn-13' : '978-0812988529' } }", "{ 'title': 'Of Mice and Men', 'author': 'John Steinbeck', 'pages': 112, 'isbn': { 'isbn-10' : '0140177396', 'isbn-13' : '978-0140177398' } }", "{ 'title': 'Gone with the Wind', 'author': 'Margaret Mitchell', 'pages': 960, 'isbn': { 'isbn-10' : '1451635621', 'isbn-13' : '978-1451635621' } }", "{ 'title': 'Fahrenheit 451', 'author': 'Ray Bradbury', 'pages': 249, 'isbn': { 'isbn-10' : '9781451673319', 'isbn-13' : '978-1451673319' } }", "{ 'title': 'The Old Man and the Sea', 'author': 'Ernest Hemingway', 'pages': 128, 'isbn': { 'isbn-10' : '0684801221', 'isbn-13' : '978-0684801223' } }", "{ 'title': 'The Great Gatsby', 'author': 'F. Scott Fitzgerald', 'pages': 180, 'isbn': { 'isbn-10' : '9780743273565', 'isbn-13' : '978-0743273565' } }", }; var payload = "[" + string.Join(',', items) + "]"; var insertManyResult = await controller.MultiInsert(new DatabaseRouteParameters() { DatabaseName = DATABASE_NAME, CollectionName = collectionName }, payload); var insertManyMvcResult = ((OkObjectResult)insertManyResult); Assert.Equal(200, insertManyMvcResult.StatusCode); var findResult = await controller.FindObjects(new DatabaseRouteParameters() { DatabaseName = DATABASE_NAME, CollectionName = collectionName }, new FindQueryParameters() { Start = start, Limit = limit }, findExpression); var findMvcResult = ((OkObjectResult)findResult); Assert.Equal(200, findMvcResult.StatusCode); var array = JArray.Parse(findMvcResult.Value.ToString()); Assert.Equal(expectedCount, array.Count); // Delete the collection var deleteCollectionResult = await controller.DeleteCollection(new DatabaseRouteParameters { DatabaseName = DATABASE_NAME, CollectionName = collectionName }); var deleteCollectionMvcResult = ((OkResult)deleteCollectionResult); Assert.Equal(200, deleteCollectionMvcResult.StatusCode); }