public void GetAllAlbumsListTest() { //Setup Mock <IDataContext> mock = new Mock <IDataContext>(); mock.Setup(context => context.Albums).Returns(GetAlbumsList()); AlbumsController albumsController = new AlbumsController(mock.Object); //Action IActionResult result = albumsController.GetAll(); //Assert var status = Assert.IsType <OkObjectResult>(result); var model = Assert.IsAssignableFrom <IEnumerable <AlbumModel> >(status.Value); Assert.Equal(GetAlbumsList().Count(), model.Count()); }