This is the way git.git **[performs](https://github.com/git/git/blob/master/t/test-lib-functions.sh#L123-L133)** its own integration tests.
There's something **[similar](https://github.com/libgit2/libgit2sharp/blob/vNext/LibGit2Sharp.Tests/TestHelpers/SignatureExtensions.cs)** in the LibGit2Sharp test helpers.