title: Mock IEnumerable<T> is returning null
body: <p>I am using XUnit unit tests for testing my API Controllers in .NET Core 2.1.  I am using MOQ for mocking my interfaced repositories.  Debugging my unit test when I do the setup it still comes out null before it even hits the controller.</p>
  
  <p>I have tried constructing the result using <code>Returns</code> or <code>ReturnsAsync</code>.  Using a separate function to return a list or a <code>IEnumerable&lt;T&gt;</code>.</p>
  
  <p>Controller</p>
  
  <pre><code>[HttpGet]
  public async Task&lt;IActionResult&gt; GetPendingApprovals()
  {
      var user = _serviceRepository.GetUserName(User);
      var userId = await _serviceRepository.GetUserID(user);
  
      var result = await _requestRepository.GetPendingApprovalsByApprover(userId);
  
      if (!result.Any()) return NoContent();
  
      return Ok(result);
  
  }
  </code></pre>
  
  <p>Test</p>
  
  <pre><code>private Mock&lt;IServiceRepository&gt; mockServiceRepo;
  private Mock&lt;IRequestRepository&gt; mockRequestRepo;
  private ApprovalController controller;
  
  
  public ApproverControllerTests()
  {
      mockServiceRepo = new Mock&lt;IServiceRepository&gt;();
      mockRequestRepo = new Mock&lt;IRequestRepository&gt;();
      ILogger&lt;ApprovalController&gt; mockLoggerRepo = Mock.Of&lt;ILogger&lt;ApprovalController&gt;&gt;();
      controller = new ApprovalController(mockRequestRepo.Object, mockServiceRepo.Object, mockLoggerRepo);
  }
  
  [Fact]
  public async Task GetPendingApprovals_HasPending_ReturnsResultAsync()
  {
       // Arrange
       var mockRequests = new List&lt;Request&gt;
       {
           new Request { Id = 1,
               PONumber = "ABC0001",
               RequestorId = 1,
               SubmitDate = new DateTime(),
               ApproverId = 2,
               StatusId = 1,
               Split = false,
               VendorId1 = 1,
               Remarks = "
           },
           new Request { Id = 2,
               PONumber = "ABC0002",
               RequestorId = 1,
               SubmitDate = new DateTime(),
               ApproverId = 2,
               StatusId = 1,
               Split = false,
               VendorId1 = 1,
               Remarks = "
          }
       };
       mockServiceRepo.Setup (repo =&gt; repo.GetUserID ("pstaley").Returns (Task.FromResult (1);
       //var pending = mockRequests.AsEnumerable();
       mockRequestRepo.Setup (repo =&gt; repo.GetPendingApprovalsByApprover (1).Returns (Task.FromResult&lt;IEnumerable&lt;Request&gt;&gt; (mockRequests);
       // Act
       var result = await controller.GetPendingApprovals();
  
      // Assert
      var actionResult = Assert.IsType&lt;OkObjectResult&gt;(result);
      //Assert.Equal(mockRequests, actionResult);
  
  }
  </code></pre>
  
  <p>Debugging the test itself it the <code>mockRequest</code> is <em>null</em> so when it goes to the controller it meets the null check and returns no content response.</p>