public void GetCyphers() { // Given Mock <ICypherRepository> mockRepo = new Mock <ICypherRepository>(); mockRepo.Setup(repo => repo.Get()).ReturnsAsync(cyphers.ToList()); CyphersController controller = new CyphersController(mockRepo.Object); // When IEnumerable <Cypher> results = controller.GetAll(); List <Cypher> listResults = results.ToList(); // Then Assert.Equal(3, results.Count()); Assert.Equal(1, listResults[0].Id); Assert.Equal("Cypher 1", listResults[0].Name); Assert.Equal(2, listResults[1].Id); Assert.Equal("Cypher 2", listResults[1].Name); Assert.Equal(3, listResults[2].Id); Assert.Equal("Cypher 3", listResults[2].Name); }