title: Delay in Moq return for async method not delaying
body: <p>In my unit test, I'm trying to mock out the <code>Run()</code> async method from my interface <code>IPipeline</code> and simulate a delay, where it is called in the class <code>PipelineScheduler</code></p>
  
  <pre><code>public interface IPipeline
  {
      Task Run();
  }
  </code></pre>
  
  <p>Test Moq:</p>
  
  <pre><code>[SetUp]
  public void SetUp()
  {
      _mockPipeline = new Mock&lt;IPipeline&gt;();
  
      _mockPipeline.Setup(x =&gt; x.Run()).Returns(async () =&gt;
      {
          await Task.Delay(3000);
      });
      _scheduler = new PipelineScheduler(_mockPipeline.Object);
  }
  </code></pre>
  
  <p>However when I run the test and debug where the mocked method is called</p>
  
  <pre><code>await _pipeline.Run().ConfigureAwait(false);
  </code></pre>
  
  <p>there is no delay and execution continues after this line immediately.</p>
  
  <p>But if I replace the mock with a stub class, the delay works fine.</p>
  
  <pre><code>private class MockPipeline : IPipeline
  {
      public async Task Run()
      {
          await Task.Delay(3000);
      }
  }
  
  [SetUp]
  public void SetUp()
  {
      _mockPipeline = new MockPipeline();
      _scheduler = new PipelineScheduler(_mockPipeline);
  }
  </code></pre>
  
  <p>So I suppose the question is what's different from how I'm creating the delay with moq vs my stubbed class?</p>