Example #1
0
        public void GetComment_Basic()
        {
            // "{0} {1} > {2}, {3}: {4}"
            string comment  = CommentBuilder.GetComment(_someComment, _changesetId, _ownerLong, _source, _target, MergeOptionsEx.None);
            string expected = $"{_source} {_changesetId} > {_target}, {_ownerShort}: {_someComment}";

            PrintResults(null, expected, comment);
            comment.Should().Be(expected);
        }
Example #2
0
        public void GetComment_ReplacePreviousPrefix_WasRangeWithOneOwner()
        {
            string commentWithOldPrefix = $"{_source} {_changesetId}-{_changesetId + 1} > {_target}, {_ownerShort}: {_someComment}";

            const string newSource = "NewSource";
            const string newTarget = "NewTarget";
            const int    newId     = _changesetId + 10;

            string comment  = CommentBuilder.GetComment(commentWithOldPrefix, newId, _ownerLong, newSource, newTarget, MergeOptionsEx.None);
            string expected = $"{newSource} {newId} > {newTarget}, {_ownerShort}: {_someComment}";

            PrintResults(commentWithOldPrefix, expected, comment);
            comment.Should().Be(expected);
        }
Example #3
0
        public void GetComment_ReplacePreviousPrefix_NonCaseSensitive()
        {
            string commentWithOldPrefix = $"{_source.ToLowerInvariant()} {_changesetId} > {_target.ToLowerInvariant()}, {_ownerShort.ToLowerInvariant()}: {_someComment}";

            const string newSource  = "NewSource";
            const string newTarget  = "NewTarget";
            const int    newId      = _changesetId + 1;
            const string mergeOwner = "IShould NotOwnThis";

            string comment  = CommentBuilder.GetComment(commentWithOldPrefix, newId, mergeOwner, newSource, newTarget, MergeOptionsEx.None);
            string expected = $"{newSource} {newId} > {newTarget}, {_ownerShort.ToLowerInvariant()}: {_someComment}";

            PrintResults(commentWithOldPrefix, expected, comment);
            comment.Should().Be(expected);
        }
Example #4
0
        public void GetComment_ReplacePreviousPrefix_WithSpecialChars()
        {
            const string oldSource            = "Old.Sour-ce";
            const string oldTarget            = "Old.Tar_get";
            string       commentWithOldPrefix = $"{oldSource} {_changesetId} > {oldTarget}, {_ownerShort}: {_someComment}";

            const string newSource  = "New.Sour_ce";
            const string newTarget  = "New.Tar-get";
            const int    newId      = _changesetId + 1;
            const string mergeOwner = "IShould NotOwnThis";

            string comment  = CommentBuilder.GetComment(commentWithOldPrefix, newId, mergeOwner, newSource, newTarget, MergeOptionsEx.None);
            string expected = $"{newSource} {newId} > {newTarget}, {_ownerShort}: {_someComment}";

            PrintResults(commentWithOldPrefix, expected, comment);
            comment.Should().Be(expected);
        }
Example #5
0
        public void GetComment_ReplacePreviousPrefix_WasRangeWithManyOwners()
        {
            const int ownerCount           = 3;
            string    desiredOwner         = $"{ownerCount} authors";
            string    commentWithOldPrefix =
                $"{_source} {_changesetId}-{_changesetId + 4} > {_target}, " + desiredOwner + $": {_someComment}";

            const string newSource = "NewSource";
            const string newTarget = "NewTarget";
            const int    newId     = _changesetId + 10;

            string comment  = CommentBuilder.GetComment(commentWithOldPrefix, newId, _ownerLong, newSource, newTarget, MergeOptionsEx.None);
            string expected = $"{newSource} {newId} > {newTarget}, {desiredOwner}: {_someComment}";

            PrintResults(commentWithOldPrefix, expected, comment);
            comment.Should().Be(expected);
        }