public async Task Assert_GetAllFeedback_is_correct() { ActionResult result = await feedbackController.GetAllFeedback(); var okResult = result as OkObjectResult; List <Feedback> feedback = okResult.Value as List <Feedback>; Assert.AreEqual(1, feedback.Count); }
public void JsonCountIsCorrect() { var feedbackData = new InMemoryFeedbackData(); var ctrl = new FeedbackController(feedbackData); var getAll = ctrl.GetAllFeedback(); if (getAll is Microsoft.AspNetCore.Mvc.JsonResult json) { var list = json.Value as List <RiihiSoftReact.Models.Feedback>; Assert.NotNull(list); Assert.Equal(list.Count, feedbackData.Feedbacks.Count); } else { Assert.True(false); } }