public async Task ShouldListAllStudentUids() { var mockRepo = new Mock <IDataRepository>(); mockRepo.Setup(repo => repo.StudentListAsync()). ReturnsAsync(GetStudentData()); StudentsController controller = new StudentsController(mockRepo.Object); var result = await controller.GetAllStudentUids(); Assert.IsInstanceOfType(result.Result, typeof(OkObjectResult)); var okResult = result.Result as OkObjectResult; var uids = okResult.Value as List <string>; Assert.AreEqual(2, uids.Count); Assert.AreEqual("mwj7", uids[0]); Assert.AreEqual("dop2", uids[1]); }