public void RunTest(string assemblyFileName, string mainTypeName, string methodName) { domainPool.SubmitSnippet(new SnippetInfo() { assemblyFile = System.IO.File.ReadAllBytes(assemblyFileName), mainTypeName = mainTypeName, methodName = methodName }); }
private Task <SnippetResult> DoStuffAndReturnWhenIdFinished(Guid snippetId) { // Use a TCS for a Task without a "thread" // http://blogs.msdn.com/b/pfxteam/archive/2009/06/02/9685804.aspx var tcs = new TaskCompletionSource <SnippetResult>(); try { // Post in queue, and return immediately // The pool/deque will "call us back" (set the status) when finished var snippetData = repository.Get(snippetId); var snippetInfo = new SnippetInfo() { assemblyFile = snippetData.AssemblyBytes, mainTypeName = SnippetData.SnippetTypeName, methodName = SnippetData.SnippetMethodName, submissionId = Guid.NewGuid().ToString() }; domainPool.SubmitSnippet(snippetInfo, tcs); } catch (Exception ex) { tcs.TrySetException(ex); } // Return immediately, with the task we can await on return(tcs.Task); }