private void RunCommitInfoTest(Action <GitUI.CommitInfo.CommitInfo> runTest) { UITest.RunControl( createControl: form => { var uiCommandsSource = Substitute.For <IGitUICommandsSource>(); uiCommandsSource.UICommands.Returns(x => _commands); // the following assignment of CommitInfo.UICommandsSource will already call this command _gitExecutable.StageOutput("for-each-ref --sort=-taggerdate --format=\"%(refname)\" refs/tags/", ""); return(new GitUI.CommitInfo.CommitInfo { Parent = form, UICommandsSource = uiCommandsSource }); }, runTestAsync: async commitInfo => { // Wait for pending operations so the Control is loaded completely before testing it await AsyncTestHelper.JoinPendingOperationsAsync(AsyncTestHelper.UnexpectedTimeout); runTest(commitInfo); }); }