public void ReadRegisteredAgents_ShouldCall_From_Repository() { // Arrange mockRepository.Setup(repository => repository.GetAllAgentsInfo()).Returns(GetTestAgentsInfo()); //Act var result = controller.ReadRegisteredAgents(); // Assert var response = ((result as OkObjectResult).Value as AllAgentsInfoResponse).Agents; Assert.Equal(GetTestAgentsInfo().Count, response.Count); }