public void GetAllTrainings() { //Init the WebAPI service var controller = new TrainingController(mockContext.Object); //Check the equality between the returned data and the expected data var result = controller.GetTrainingInfo(); //as List<TrainingInfo>; Assert.IsNotNull(result); Assert.AreEqual(data.Count(), ((System.Linq.EnumerableQuery <TrainingAPI.Models.TrainingInfo>)result).Count()); }