public void Save_WhenLastIssueFileExists_ShouldDeleteIt() { A.CallTo(() => m_file.Exists($@"{m_repositoryDirectory}\.git\gitarmor\issuetracker\lastissue")).Returns(true); m_lastIssue.Save("123"); A.CallTo(() => m_file.Delete($@"{m_repositoryDirectory}\.git\gitarmor\issuetracker\lastissue")) .MustHaveHappened(); }
public void Save(string issue) { var directory = Path.GetDirectoryName(m_lastIssueFile); if (!m_directoryUtilities.Exists(directory)) { m_directoryUtilities.CreateDirectory(directory); } if (m_fileUtilities.Exists(m_lastIssueFile)) { m_fileUtilities.Delete(m_lastIssueFile); } using (var stream = m_fileUtilities.CreateText(m_lastIssueFile)) { stream.WriteLine(issue); } }