public void SetUp() { if (_referenceRepository == null) { _referenceRepository = new ReferenceRepository(); } else { _referenceRepository.Reset(); } _commands = new GitUICommands(_referenceRepository.Module); // mock git executable _gitExecutable = new MockExecutable(); typeof(GitModule).GetField("_gitExecutable", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(_commands.Module, _gitExecutable); var cmdRunner = new GitCommandRunner(_gitExecutable, () => GitModule.SystemEncoding); typeof(GitModule).GetField("_gitCommandRunner", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(_commands.Module, cmdRunner); 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/", ""); _commitInfo = new GitUI.CommitInfo.CommitInfo { UICommandsSource = uiCommandsSource }; }
public void SetUp() { if (_referenceRepository == null) { _referenceRepository = new ReferenceRepository(); } else { _referenceRepository.Reset(); } _commands = new GitUICommands(_referenceRepository.Module); // mock git executable _gitExecutable = new MockExecutable(); typeof(GitModule).GetField("_gitExecutable", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(_commands.Module, _gitExecutable); var cmdRunner = new GitCommandRunner(_gitExecutable, () => GitModule.SystemEncoding); typeof(GitModule).GetField("_gitCommandRunner", BindingFlags.Instance | BindingFlags.NonPublic) .SetValue(_commands.Module, cmdRunner); var uiCommandsSource = Substitute.For <IGitUICommandsSource>(); uiCommandsSource.UICommands.Returns(x => _commands); _commitInfo = new GitUI.CommitInfo.CommitInfo { UICommandsSource = uiCommandsSource }; }