Ejemplo n.º 1
0
    public void ShouldWarnAboutMissingGitConfiguration()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);

        var workingFilePath = Path.Join(_testSetup.WorkingDirectory, "hello.txt");

        // Create and commit a test file
        File.WriteAllText(workingFilePath, "First line of text");
        CommitAll(_testSetup.Repository);

        var configurationValues = new[] { "user.name", "user.email" }
        .SelectMany(key => Enum.GetValues(typeof(ConfigurationLevel))
                    .Cast <ConfigurationLevel>()
                    .Select(level => _testSetup.Repository.Config.Get <string>(key, level)))
        .Where(c => c != null)
        .ToList();

        try
        {
            configurationValues.ForEach(c => _testSetup.Repository.Config.Unset(c.Key, c.Level));

            var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

            Should.Throw <CommandLineExitException>(() => workingCopy.Versionize(new VersionizeOptions()));
            _testPlatformAbstractions.Messages.Last().ShouldStartWith("Warning: Git configuration is missing");
        }
        finally
        {
            configurationValues.ForEach(c => _testSetup.Repository.Config.Set(c.Key, c.Value, c.Level));
        }
    }
Ejemplo n.º 2
0
    public void ShouldPrereleaseToCurrentMaximumPrereleaseVersion()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);
        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        var fileCommitter = new FileCommitter(_testSetup);

        // Release an initial version
        fileCommitter.CommitChange("chore: initial commit");
        workingCopy.Versionize(new VersionizeOptions());

        // Prerelease as minor alpha
        fileCommitter.CommitChange("feat: feature pre-release");
        workingCopy.Versionize(new VersionizeOptions {
            Prerelease = "alpha"
        });

        // Prerelease as major alpha
        fileCommitter.CommitChange("chore: initial commit\n\nBREAKING CHANGE: This is a breaking change");
        workingCopy.Versionize(new VersionizeOptions {
            Prerelease = "alpha"
        });

        var versionTagNames = VersionTagNames.ToList();

        versionTagNames.ShouldBe(new[] { "v1.0.0", "v1.1.0-alpha.0", "v2.0.0-alpha.0" });
    }
Ejemplo n.º 3
0
        public void ShouldExitIfNoWorkingCopyCouldBeDiscovered()
        {
            var directoryWithoutWorkingCopy = Path.Combine(Path.GetTempPath(), "ShouldExitIfNoWorkingCopyCouldBeDiscovered");

            Directory.CreateDirectory(directoryWithoutWorkingCopy);

            Assert.Throws <CommandLineExitException>(() => WorkingCopy.Discover(directoryWithoutWorkingCopy));
        }
Ejemplo n.º 4
0
        public void ShouldExitIfWorkingCopyContainsNoProjects()
        {
            var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

            Should.Throw <CommandLineExitException>(() => workingCopy.Versionize());

            _testPlatformAbstractions.Messages[0].ShouldBe($"Could not find any projects files in {_testSetup.WorkingDirectory} that have a <Version> defined in their csproj file.");
        }
Ejemplo n.º 5
0
        public void ShouldPreformADryRun()
        {
            var workingCopy = WorkingCopy.Discover(Directory.GetCurrentDirectory());

            workingCopy.Versionize(dryrun: true, skipDirtyCheck: true);

            // TODO: Assert messages
        }
Ejemplo n.º 6
0
        public void ShouldPreformADryRun()
        {
            var workingCopy = WorkingCopy.Discover(Directory.GetCurrentDirectory());

            workingCopy.Versionize(dryrun: true, skipDirtyCheck: true);

            _testPlatformAbstractions.Messages.Count.ShouldBe(4);
            _testPlatformAbstractions.Messages[0].ShouldBe("Discovered 1 versionable projects");
        }
Ejemplo n.º 7
0
        public void ShouldExitGracefullyIfNoGitInitialized()
        {
            var workingDirectory = TempDir.Create();

            Should.Throw <CommandLineExitException>(() => WorkingCopy.Discover(workingDirectory));

            _testPlatformAbstractions.Messages[0].ShouldBe($"Directory {workingDirectory} or any parent directory do not contain a git working copy");

            Cleanup.DeleteDirectory(workingDirectory);
        }
Ejemplo n.º 8
0
        public void ShouldExitIfWorkingCopyIsDirty()
        {
            TempCsProject.Create(_testSetup.WorkingDirectory);

            var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

            Should.Throw <CommandLineExitException>(() => workingCopy.Versionize());

            _testPlatformAbstractions.Messages.ShouldHaveSingleItem();
            _testPlatformAbstractions.Messages[0].ShouldBe($"Repository {_testSetup.WorkingDirectory} is dirty. Please commit your changes.");
        }
Ejemplo n.º 9
0
    public void ShouldExitIfReleaseAsSpecifiedVersionIsInvalid()
    {
        TempProject.CreateCsharpProject(Path.Join(_testSetup.WorkingDirectory, "project1"), "1.1.0");

        CommitAll(_testSetup.Repository);

        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        Should.Throw <CommandLineExitException>(() => workingCopy.Versionize(new VersionizeOptions {
            ReleaseAs = "kanguru"
        }));
    }
Ejemplo n.º 10
0
        public void ShouldExitIfProjectsUseInconsistentNaming()
        {
            TempCsProject.Create(Path.Join(_testSetup.WorkingDirectory, "project1"), "1.1.0");
            TempCsProject.Create(Path.Join(_testSetup.WorkingDirectory, "project2"), "2.0.0");

            CommitAll(_testSetup.Repository);

            var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

            Should.Throw <CommandLineExitException>(() => workingCopy.Versionize());
            _testPlatformAbstractions.Messages[0].ShouldBe($"Some projects in {_testSetup.WorkingDirectory} have an inconsistent <Version> defined in their csproj file. Please update all versions to be consistent or remove the <Version> elements from projects that should not be versioned");
        }
Ejemplo n.º 11
0
    public void InspectShouldExitIfNoProjectWithVersionIsFound()
    {
        TempProject.CreateFromProjectContents(_testSetup.WorkingDirectory, "csproj", @"<Project Sdk=""Microsoft.NET.Sdk"">
    <PropertyGroup>
    </PropertyGroup>
</Project>");

        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        Should.Throw <CommandLineExitException>(() => workingCopy.Inspect());

        _testPlatformAbstractions.Messages.ShouldHaveSingleItem();
        _testPlatformAbstractions.Messages[0].ShouldEndWith(" that have a <Version> defined in their csproj file.");
    }
Ejemplo n.º 12
0
        public void ShouldExitIfWorkingCopyContainsNoProjects()
        {
            var workingDirectory = TempDir.Create();

            using var tempRepository = TempRepository.Create(workingDirectory);

            var workingCopy = WorkingCopy.Discover(workingDirectory);

            Should.Throw <CommandLineExitException>(() => workingCopy.Versionize());

            _testPlatformAbstractions.Messages[0].ShouldBe($"Could not find any projects files in {workingDirectory} that have a <Version> defined in their csproj file.");

            Cleanup.DeleteDirectory(workingDirectory);
        }
Ejemplo n.º 13
0
    public void ShouldReleaseAsSpecifiedVersion()
    {
        TempProject.CreateCsharpProject(Path.Join(_testSetup.WorkingDirectory, "project1"), "1.1.0");

        CommitAll(_testSetup.Repository);

        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        workingCopy.Versionize(new VersionizeOptions {
            ReleaseAs = "2.0.0"
        });

        _testSetup.Repository.Tags.Select(t => t.FriendlyName).ShouldBe(new[] { "v2.0.0" });
    }
Ejemplo n.º 14
0
    public void ShouldSupportFsharpProjects()
    {
        TempProject.CreateFsharpProject(_testSetup.WorkingDirectory);

        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        var fileCommitter = new FileCommitter(_testSetup);

        // Release an initial version
        fileCommitter.CommitChange("chore: initial commit");
        workingCopy.Versionize(new VersionizeOptions());

        var versionTagNames = VersionTagNames.ToList();

        versionTagNames.ShouldBe(new[] { "v1.0.0" });
    }
Ejemplo n.º 15
0
        public void ShouldPreformADryRun()
        {
            TempCsProject.Create(_testSetup.WorkingDirectory);

            File.WriteAllText(Path.Join(_testSetup.WorkingDirectory, "hello.txt"), "First commit");
            CommitAll(_testSetup.Repository);

            File.WriteAllText(Path.Join(_testSetup.WorkingDirectory, "hello.txt"), "Second commit");
            CommitAll(_testSetup.Repository);

            var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

            workingCopy.Versionize(dryrun: true, skipDirtyCheck: true);

            _testPlatformAbstractions.Messages.Count.ShouldBe(4);
            _testPlatformAbstractions.Messages[0].ShouldBe("Discovered 1 versionable projects");
        }
Ejemplo n.º 16
0
    public void ShouldExitForInvalidReleaseAsReleases()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);
        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        var fileCommitter = new FileCommitter(_testSetup);

        // Release an initial version
        fileCommitter.CommitChange("chore: initial commit");
        workingCopy.Versionize(new VersionizeOptions());

        // Release as lower than current version
        fileCommitter.CommitChange("feat: some feature");
        Should.Throw <CommandLineExitException>(() => workingCopy.Versionize(new VersionizeOptions {
            ReleaseAs = "0.9.0"
        }));
    }
Ejemplo n.º 17
0
    public void ShouldEmitAUsefulErrorMessageForDuplicateTags()
    {
        TempProject.CreateCsharpProject(Path.Join(_testSetup.WorkingDirectory, "project1"), "1.1.0");

        CommitAll(_testSetup.Repository);

        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        workingCopy.Versionize(new VersionizeOptions {
            ReleaseAs = "2.0.0"
        });

        Should.Throw <CommandLineExitException>(() => workingCopy.Versionize(new VersionizeOptions {
            ReleaseAs = "2.0.0"
        }));

        _testPlatformAbstractions.Messages.Last().ShouldBe("Version 2.0.0 already exists. Please use a different version.");
    }
Ejemplo n.º 18
0
    public void ShouldExitWithNonZeroExitCodeForInsignificantCommits()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);

        var workingCopy   = WorkingCopy.Discover(_testSetup.WorkingDirectory);
        var fileCommitter = new FileCommitter(_testSetup);

        // Release an initial version first
        fileCommitter.CommitChange("chore: initial commit");
        workingCopy.Versionize(new VersionizeOptions());

        // Insignificant change release
        fileCommitter.CommitChange("chore: insignificant change");
        Should.Throw <CommandLineExitException>(() => workingCopy.Versionize(new VersionizeOptions {
            ExitInsignificantCommits = true
        }));

        _testPlatformAbstractions.Messages.Last().ShouldStartWith("Version was not affected by commits since last release");
    }
Ejemplo n.º 19
0
        public void ShouldIgnoreInsignificantCommits()
        {
            var workingDirectory = TempDir.Create();

            using var tempRepository = TempRepository.Create(workingDirectory);

            TempCsProject.Create(workingDirectory);

            var workingFilePath = Path.Join(workingDirectory, "hello.txt");

            // Create and commit a test file
            File.WriteAllText(workingFilePath, "First line of text");
            CommitAll(tempRepository);

            // Run versionize
            var workingCopy = WorkingCopy.Discover(workingDirectory);

            workingCopy.Versionize();

            // Add insignificant change
            File.AppendAllText(workingFilePath, "This is another line of text");
            CommitAll(tempRepository, "chore: Added line of text");

            // Get last commit
            var lastCommit = tempRepository.Head.Tip;

            // Run versionize, ignoring insignificant commits
            try
            {
                workingCopy.Versionize(ignoreInsignificant: true);

                throw new InvalidOperationException("Expected to throw in Versionize call");
            }
            catch (CommandLineExitException ex)
            {
                ex.ExitCode.ShouldBe(0);
            }

            lastCommit.ShouldBe(tempRepository.Head.Tip);

            // Cleanup
            Cleanup.DeleteDirectory(workingDirectory);
        }
Ejemplo n.º 20
0
    public void InspectShouldExitForProjectsInconsistentVersion()
    {
        TempProject.CreateFromProjectContents(_testSetup.WorkingDirectory + "/project1", "csproj", @"<Project Sdk=""Microsoft.NET.Sdk"">
    <PropertyGroup>
        <Version>1.0.0</Version>
    </PropertyGroup>
</Project>");

        TempProject.CreateFromProjectContents(_testSetup.WorkingDirectory + "/project2", "csproj", @"<Project Sdk=""Microsoft.NET.Sdk"">
    <PropertyGroup>
        <Version>2.0.0</Version>
    </PropertyGroup>
</Project>");

        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        Should.Throw <CommandLineExitException>(() => workingCopy.Inspect());

        _testPlatformAbstractions.Messages.ShouldHaveSingleItem();
        _testPlatformAbstractions.Messages[0].ShouldContain("have an inconsistent <Version> defined in their csproj file");
    }
Ejemplo n.º 21
0
        public void ShouldAddSuffixToReleaseCommitMessage()
        {
            TempCsProject.Create(_testSetup.WorkingDirectory);

            var workingFilePath = Path.Join(_testSetup.WorkingDirectory, "hello.txt");

            // Create and commit a test file
            File.WriteAllText(workingFilePath, "First line of text");
            CommitAll(_testSetup.Repository);

            // Run versionize
            var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);
            var suffix      = "[skip ci]";

            workingCopy.Versionize(releaseCommitMessageSuffix: suffix);

            // Get last commit
            var lastCommit = _testSetup.Repository.Head.Tip;

            lastCommit.Message.ShouldContain(suffix);
        }
Ejemplo n.º 22
0
    public void ShouldPerformADryRun()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);

        File.WriteAllText(Path.Join(_testSetup.WorkingDirectory, "hello.txt"), "First commit");
        CommitAll(_testSetup.Repository, "feat: first commit");

        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        workingCopy.Versionize(new VersionizeOptions {
            DryRun = true, SkipDirty = true
        });

        _testPlatformAbstractions.Messages.Count.ShouldBe(7);
        _testPlatformAbstractions.Messages[0].ShouldBe("Discovered 1 versionable projects");
        _testPlatformAbstractions.Messages[3].ShouldBe("\n---");
        _testPlatformAbstractions.Messages[4].ShouldContain("* first commit");
        _testPlatformAbstractions.Messages[5].ShouldBe("---\n");
        var wasChangelogWritten = File.Exists(Path.Join(_testSetup.WorkingDirectory, "CHANGELOG.md"));

        Assert.False(wasChangelogWritten);
    }
Ejemplo n.º 23
0
    public void ShouldIgnoreInsignificantCommits()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);

        var workingFilePath = Path.Join(_testSetup.WorkingDirectory, "hello.txt");

        // Create and commit a test file
        File.WriteAllText(workingFilePath, "First line of text");
        CommitAll(_testSetup.Repository);

        // Run versionize
        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        workingCopy.Versionize(new VersionizeOptions());

        // Add insignificant change
        File.AppendAllText(workingFilePath, "This is another line of text");
        CommitAll(_testSetup.Repository, "chore: Added line of text");

        // Get last commit
        var lastCommit = _testSetup.Repository.Head.Tip;

        // Run versionize, ignoring insignificant commits
        try
        {
            workingCopy.Versionize(new VersionizeOptions {
                IgnoreInsignificantCommits = true
            });

            throw new InvalidOperationException("Expected to throw in Versionize call");
        }
        catch (CommandLineExitException ex)
        {
            ex.ExitCode.ShouldBe(0);
        }

        lastCommit.ShouldBe(_testSetup.Repository.Head.Tip);
    }
Ejemplo n.º 24
0
    public void ShouldExitForInvalidPrereleaseSequences()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);
        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        var fileCommitter = new FileCommitter(_testSetup);

        // Release an initial version
        fileCommitter.CommitChange("chore: initial commit");
        workingCopy.Versionize(new VersionizeOptions());

        // Prerelease a minor beta
        fileCommitter.CommitChange("feat: feature pre-release");
        workingCopy.Versionize(new VersionizeOptions {
            Prerelease = "beta"
        });

        // Try Prerelease a minor alpha
        fileCommitter.CommitChange("feat: feature pre-release");
        Should.Throw <CommandLineExitException>(() => workingCopy.Versionize(new VersionizeOptions {
            Prerelease = "alpha"
        }));
    }
Ejemplo n.º 25
0
    public static int Main(string[] args)
    {
        var app = new CommandLineApplication
        {
            Name = "versionize",
            UsePagerForHelpText = false
        };

        app.HelpOption();
        app.VersionOption("-v|--version", GetVersion());

        var optionWorkingDirectory = app.Option("-w|--workingDir <WORKING_DIRECTORY>", "Directory containing projects to version", CommandOptionType.SingleValue);
        var optionDryRun           = app.Option("-d|--dry-run", "Skip changing versions in projects, changelog generation and git commit", CommandOptionType.NoValue);
        var optionSkipDirty        = app.Option("--skip-dirty", "Skip git dirty check", CommandOptionType.NoValue);
        var optionReleaseAs        = app.Option("-r|--release-as <VERSION>", "Specify the release version manually", CommandOptionType.SingleValue);
        var optionSilent           = app.Option("--silent", "Suppress output to console", CommandOptionType.NoValue);

        var optionSkipCommit                   = app.Option("--skip-commit", "Skip commit and git tag after updating changelog and incrementing the version", CommandOptionType.NoValue);
        var optionIgnoreInsignificant          = app.Option("-i|--ignore-insignificant-commits", "Do not bump the version if no significant commits (fix, feat or BREAKING) are found", CommandOptionType.NoValue);
        var optionExitInsignificant            = app.Option("--exit-insignificant-commits", "Exits with a non zero exit code if no significant commits (fix, feat or BREAKING) are found", CommandOptionType.NoValue);
        var optionIncludeAllCommitsInChangelog = app.Option("--changelog-all", "Include all commits in the changelog not just fix, feat and breaking changes", CommandOptionType.NoValue);
        var optionCommitSuffix                 = app.Option("--commit-suffix", "Suffix to be added to the end of the release commit message (e.g. [skip ci])", CommandOptionType.SingleValue);
        var optionPrerelease                   = app.Option("-p|--pre-release", "Release as pre-release version with given pre release label.", CommandOptionType.SingleValue);
        var optionAggregatePrereleases         = app.Option("-a|--aggregate-pre-releases", "Include all pre-release commits in the changelog since the last full version.", CommandOptionType.NoValue);

        var inspectCmd = app.Command("inspect", inspectCmd => inspectCmd.OnExecute(() =>
        {
            var cwd = optionWorkingDirectory.Value() ?? Directory.GetCurrentDirectory();

            WorkingCopy
            .Discover(cwd)
            .Inspect();

            return(0);
        }));

        inspectCmd.Description = "Prints the current version to stdout";

        app.OnExecute(() =>
        {
            var cwd            = optionWorkingDirectory.Value() ?? Directory.GetCurrentDirectory();
            var jsonFileConfig = FromJsonFile(Path.Join(cwd, ".versionize"));

            var options = MergeWithOptions(jsonFileConfig, new VersionizeOptions
            {
                DryRun     = optionDryRun.HasValue(),
                SkipDirty  = optionSkipDirty.HasValue(),
                SkipCommit = optionSkipCommit.HasValue(),
                ReleaseAs  = optionReleaseAs.Value(),
                IgnoreInsignificantCommits = optionIgnoreInsignificant.HasValue(),
                ExitInsignificantCommits   = optionExitInsignificant.HasValue(),
                CommitSuffix         = optionCommitSuffix.Value(),
                Prerelease           = optionPrerelease.Value(),
                Changelog            = ChangelogOptions.Default,
                AggregatePrereleases = optionAggregatePrereleases.HasValue(),
            },
                                           optionIncludeAllCommitsInChangelog.HasValue());

            CommandLineUI.Verbosity = MergeBool(optionSilent.HasValue(), jsonFileConfig?.Silent) ? LogLevel.Silent : LogLevel.All;

            WorkingCopy
            .Discover(cwd)
            .Versionize(options);

            return(0);
        });

        try
        {
            return(app.Execute(args));
        }
        catch (Exception ex) when(ex is UnrecognizedCommandParsingException ||
                                  ex is InvalidPrereleaseIdentifierException)
        {
            return(CommandLineUI.Exit(ex.Message, 1));
        }
        catch (LibGit2Sharp.NotFoundException e)
        {
            return(CommandLineUI.Exit($@"
Error: LibGit2Sharp.NotFoundException

This is most likely caused by running versionize against a git repository cloned with depth --1.
In case you're using the actions/checkout@v2 in github actions you could specify fetch-depth: '1'.
For more detail see  https://github.com/actions/checkout

Exception detail:

{e}", 1));
        }
    }
Ejemplo n.º 26
0
        public void ShouldExitIfWorkingCopyDoesNotExist()
        {
            var directoryWithoutWorkingCopy = Path.Combine(Path.GetTempPath(), "ShouldExitIfWorkingCopyDoesNotExist");

            Assert.Throws <CommandLineExitException>(() => WorkingCopy.Discover(directoryWithoutWorkingCopy));
        }
Ejemplo n.º 27
0
    public void ShouldAggregatePrereleases()
    {
        TempProject.CreateCsharpProject(_testSetup.WorkingDirectory);
        var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

        var fileCommitter = new FileCommitter(_testSetup);

        // Release an initial version
        fileCommitter.CommitChange("feat: initial commit");
        workingCopy.Versionize(new VersionizeOptions {
            AggregatePrereleases = true
        });

        // Prerelease as patch alpha
        fileCommitter.CommitChange("fix: a fix");
        workingCopy.Versionize(new VersionizeOptions {
            Prerelease = "alpha", AggregatePrereleases = true
        });

        // Prerelease as minor alpha
        fileCommitter.CommitChange("feat: a feature");
        workingCopy.Versionize(new VersionizeOptions {
            Prerelease = "alpha", AggregatePrereleases = true
        });

        // Full release
        workingCopy.Versionize(new VersionizeOptions {
            AggregatePrereleases = true
        });

        // Full release
        fileCommitter.CommitChange("feat: another feature");
        workingCopy.Versionize(new VersionizeOptions {
            AggregatePrereleases = true
        });

        var versionTagNames = VersionTagNames.ToList();

        versionTagNames.ShouldBe(new[] { "v1.0.0", "v1.0.1-alpha.0", "v1.1.0", "v1.1.0-alpha.0", "v1.2.0" });

        var commitDate        = DateTime.Now.ToString("yyyy-M-d");
        var changelogContents = File.ReadAllText(Path.Join(_testSetup.WorkingDirectory, "CHANGELOG.md"));
        var sb = new ChangelogStringBuilder();

        sb.Append(ChangelogOptions.Preamble);

        sb.Append("<a name=\"1.2.0\"></a>");
        sb.Append($"## 1.2.0 ({commitDate})", 2);
        sb.Append("### Features", 2);
        sb.Append("* another feature", 2);

        sb.Append("<a name=\"1.1.0\"></a>");
        sb.Append($"## 1.1.0 ({commitDate})", 2);
        sb.Append("### Features", 2);
        sb.Append("* a feature", 2);
        sb.Append("### Bug Fixes", 2);
        sb.Append("* a fix", 2);

        sb.Append("<a name=\"1.1.0-alpha.0\"></a>");
        sb.Append($"## 1.1.0-alpha.0 ({commitDate})", 2);
        sb.Append("### Features", 2);
        sb.Append("* a feature", 2);
        sb.Append("### Bug Fixes", 2);
        sb.Append("* a fix", 2);

        sb.Append("<a name=\"1.0.1-alpha.0\"></a>");
        sb.Append($"## 1.0.1-alpha.0 ({commitDate})", 2);
        sb.Append("### Bug Fixes", 2);
        sb.Append("* a fix", 2);

        sb.Append("<a name=\"1.0.0\"></a>");
        sb.Append($"## 1.0.0 ({commitDate})", 2);
        sb.Append("### Features", 2);
        sb.Append("* initial commit", 2);

        Assert.Equal(sb.Build(), changelogContents);
    }
Ejemplo n.º 28
0
        public void ShouldDiscoverGitWorkingCopies()
        {
            var workingCopy = WorkingCopy.Discover(Directory.GetCurrentDirectory());

            Assert.NotNull(workingCopy);
        }
Ejemplo n.º 29
0
        public void ShouldDiscoverGitWorkingCopies()
        {
            var workingCopy = WorkingCopy.Discover(Directory.GetCurrentDirectory());

            workingCopy.ShouldNotBeNull();
        }
Ejemplo n.º 30
0
        public void ShouldDiscoverGitWorkingCopies()
        {
            var workingCopy = WorkingCopy.Discover(_testSetup.WorkingDirectory);

            workingCopy.ShouldNotBeNull();
        }