public async void TestAwait(IResultSink sink) { sink.Send("Waiting for the result..."); sink.SetResult(false); //string result = await Task<string>.Factory.StartNew(() => GetSomeStringTakesLongTime()); Task<string> t1 = new Task<string>(() => GetSomeStringTakesLongTime()); t1.Start(); string result = await t1; sink.Send(result); sink.SetResult(true); }
public void TestContracts(IResultSink res) { res.SetResult(false); }