xUnit test hangs/deadlocks when calling method with anonymous Async method
<p>I have an xUnit  (2.1.0) test that always hangs/deadlocks.  Here the code with the names of classes/methods changed for clarity and confidentiality: </p>

<pre><code>[Fact]
public void DocumentModificationTest()
{
    Exception ex = null;
    using (TestDependency testDependency = new TestDependency())
    {
        TestDependencyDocument testDependencyDoc = testDependency.Document;
        MockTestDependency fakeDependency = new MockTestDependency();
        try
        {
            DoStuffToTheDocument(testDependencyDoc, "fileName.doc", fakeDependency);
        }
        catch (Exception e)
        {
            ex = e;
        }
    }
    Assert.Null(ex);
}
</code></pre>

<p>If I set a breakpoint and step over until the assert I can see that ex is null and the test should pass and be done with, but it just hangs and I never see Test Successful on the runner.</p>

<p>Here's what DoStuffToTheDocument looks like:</p>

<pre><code>public static void DoStuffToTheDocument(TestDependencyDocument document, string pFileName, MockTestDependency pContainer)
{
    pContainer.CheckInTheDocFirst(async () =&gt;
    {
        //check some stuff
        //test returns early here

        //check other stuff(test never gets here)
        //await method (thus the async anonymous method)
    });
}
</code></pre>

<p>And lastly here's what CheckInTheDocFirst looks like:</p>

<pre><code>public void CheckInTheDocFirst(Action pConfirmAction) 
{
    pConfirmAction(); //since this is a method in a mock class only used for testing we just call the action
}
</code></pre>

<p>Any ideas whats happening here? Is there something with my async-await paradigm that is causing this test to hang?  </p>