Promise equivalent in C#
<p>In Scala there is a Promise class that could be used to complete a Future manually. I am looking for an alternative in C#.</p>

<p>I am writing a test and I want it to look it similar to this: </p>

<pre><code>// var MyResult has a field `Header`
var promise = new Promise&lt;MyResult&gt;;

handlerMyEventsWithHandler( msg =&gt;
    promise.Complete(msg);
);

// Wait for 2 seconds
var myResult = promise.Future.Await(2000);

Assert.Equals("my header", myResult.Header);
</code></pre>

<p>I understand that this is probably not the right pattern for C#, but I couldn't figure out a reasonable way to achieve the same thing even with somewhat different pattern.</p>

<p>EDIT: please note, that <code>async</code>/<code>await</code> doesn't help here, as I don't have a Task to await! I just have an access to a handler that will be run on another thread.</p>