public async Task Repository_path_can_be_passed_as_relative_path() { // ARRANGE using var temporaryDirectory = new TemporaryDirectory(); var repositoryPath = temporaryDirectory.AddSubDirectory("repo"); var git = new GitWrapper(repositoryPath, m_TestOutputHelper); await git.InitAsync(); await git.ConfigAsync("user.name", "Example"); await git.ConfigAsync("user.email", "*****@*****.**"); var commit = await git.CommitAsync("feat: Some New feature"); await git.TagAsync("v1.0.0", commit); await Task.Delay(500); var expectedOutputPath = Path.Combine(repositoryPath, "changelog.md"); // ACT var result = await RunApplicationAsync( args : new[] { "--repository", "repo" }, workingDirectory : temporaryDirectory, commandId : nameof(Repository_path_can_be_passed_as_relative_path) ); // ASSERT Assert.Equal(0, result.ExitCode); Assert.True(File.Exists(expectedOutputPath)); }
public async Task When_no_repository_is_specified_the_repository_is_located_from_the_current_directory(string relativeWorkingDirectoryPath) { // ARRANGE using var temporaryDirectory = new TemporaryDirectory(); var workingDirectory = temporaryDirectory.AddSubDirectory(relativeWorkingDirectoryPath); var git = new GitWrapper(temporaryDirectory, m_TestOutputHelper); await git.InitAsync(); await git.ConfigAsync("user.name", "Example"); await git.ConfigAsync("user.email", "*****@*****.**"); var commit = await git.CommitAsync("feat: Some New feature"); await git.TagAsync("v1.0.0", commit); await Task.Delay(500); var expectedOutputPath = Path.Combine(temporaryDirectory, "changelog.md"); var expectedOutput = String.Join(Environment.NewLine, "# Change Log", "", "## 1.0.0", "", $"#### <a id=\"changelog-heading-{commit.Id.Id}\"></a> Some New feature", "", $"- Commit: `{commit.Id.AbbreviatedId}`", ""); // ACT var result = await RunApplicationAsync( args : new[] { "--verbose" }, workingDirectory : workingDirectory, commandId : $"{nameof(When_no_repository_is_specified_the_repository_is_located_from_the_current_directory)}(\"{relativeWorkingDirectoryPath}\")" ); // ASSERT Assert.Equal(0, result.ExitCode); Assert.True(File.Exists(expectedOutputPath)); Assert.Equal(expectedOutput, File.ReadAllText(expectedOutputPath)); }
public async Task Change_log_is_generated_from_the_specified_repository() { // ARRANGE using var temporaryDirectory = new TemporaryDirectory(); var git = new GitWrapper(temporaryDirectory, m_TestOutputHelper); await git.InitAsync(); await git.ConfigAsync("user.name", "Example"); await git.ConfigAsync("user.email", "*****@*****.**"); var commit = await git.CommitAsync("feat: Some New feature"); await git.TagAsync("v1.0.0", commit); await Task.Delay(500); var expectedOutputPath = Path.Combine(temporaryDirectory, "changelog.md"); var expectedOutput = String.Join(Environment.NewLine, "# Change Log", "", "## 1.0.0", "", $"#### <a id=\"changelog-heading-{commit.Id.Id}\"></a> Some New feature", "", $"- Commit: `{commit.Id.AbbreviatedId}`", ""); // ACT var result = await RunApplicationAsync( args : new[] { "--repository", temporaryDirectory }, commandId : nameof(Change_log_is_generated_from_the_specified_repository) ); // ASSERT Assert.Equal(0, result.ExitCode); Assert.True(File.Exists(expectedOutputPath)); Assert.Equal(expectedOutput, File.ReadAllText(expectedOutputPath)); }