public void LatestCommitDateTest() { var executorMock = new Mock <ICommandLineExecutor>(); const string repoPath = "dir"; const string gitCommand = "log -1 --format=%cd"; executorMock.Setup(mock => mock.Execute("git", It.Is <string>(command => command == gitCommand), repoPath)) .Returns(new[] { "Thu Mar 12 23:38:51 2020 +0100" }); var gitCommands = new GitCommands(executorMock.Object); var result = gitCommands.DateOfLatestCommitOnBranch(repoPath); executorMock.Verify(mock => mock.Execute("git", gitCommand, repoPath), Times.Once); result.Date.Should() .BeSameDateAs(new DateTime(2020, 3, 12)); }