public void BuildAuthorLine_When_FilePath_IsDifferent(bool showAuthorDate, bool showAuthor, bool showFilePath, bool displayAuthorFirst, string expectedResult) { var line = new StringBuilder(); _blameControl.GetTestAccessor().BuildAuthorLine(_gitBlameLine, line, CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern, "fileName_different.txt", showAuthor, showAuthorDate, showFilePath, displayAuthorFirst); line.ToString().Should().StartWith(expectedResult); }
public void SetUp() { GitBlameCommit blameCommit1 = new( ObjectId.Random(), "author1", "*****@*****.**", new DateTime(2010, 3, 22, 12, 01, 02), "authorTimeZone", "committer1", "*****@*****.**", new DateTime(2010, 3, 22, 13, 01, 02), "committerTimeZone", "test summary commit1", "fileName.txt"); GitBlameCommit blameCommit2 = new( ObjectId.Random(), "author2", "*****@*****.**", new DateTime(2011, 3, 22, 12, 01, 02), "authorTimeZone", "committer2", "*****@*****.**", new DateTime(2011, 3, 22, 13, 01, 02), "committerTimeZone", "test summary commit2", "fileName.txt"); _gitBlameLine = new GitBlameLine(blameCommit1, 1, 1, "line1"); _blameControl = new BlameControl(); var blameControlTestAccessor = _blameControl.GetTestAccessor(); blameControlTestAccessor.Blame = new GitBlame(new GitBlameLine[] { _gitBlameLine, new GitBlameLine(blameCommit1, 2, 2, "line2"), new GitBlameLine(blameCommit2, 3, 3, "line3"), new GitBlameLine(blameCommit2, 4, 4, "line4"), }); }
public void SetUp() { GitBlameCommit blameCommit1 = new( ObjectId.Random(), "author1", "*****@*****.**", new DateTime(2010, 3, 22, 12, 01, 02), "authorTimeZone", "committer1", "*****@*****.**", new DateTime(2010, 3, 22, 13, 01, 02), "committerTimeZone", "test summary commit1", "fileName.txt"); GitBlameCommit blameCommit2 = new( ObjectId.Random(), "author2", "*****@*****.**", new DateTime(2011, 3, 22, 12, 01, 02), "authorTimeZone", "committer2", "*****@*****.**", new DateTime(2011, 3, 22, 13, 01, 02), "committerTimeZone", "test summary commit2", "fileName.txt"); _gitBlameLine = new GitBlameLine(blameCommit1, 1, 1, "line1"); _blameControl = new BlameControl(); var blameControlTestAccessor = _blameControl.GetTestAccessor(); blameControlTestAccessor.Blame = new GitBlame(new GitBlameLine[] { _gitBlameLine, new GitBlameLine(blameCommit1, 2, 2, "line2"), new GitBlameLine(blameCommit2, 3, 3, "line3"), new GitBlameLine(blameCommit2, 4, 4, "line4"), }); if (_referenceRepository is null) { _referenceRepository = new ReferenceRepository(); } else { _referenceRepository.Reset(); } // Creates/updates a file with name in DefaultRepoFileName _referenceRepository.CreateCommit("1", "1\n2\n3\n4\n5\n6\n7\n8\n", _fileName1, "1\n2\n3\n4\n5\n6\n7\n8\n", _fileName2); _commit2 = _referenceRepository.CreateCommit("2", "1\nb\n3\nd\n5\n6\n7\n8\n", _fileName1, "1\nb\n3\nd\n5\n6\n7\n8\n", _fileName2); _commit3 = _referenceRepository.CreateCommit("3", "1\nb\nc\nd\ne\n6\n7\n8\n", _fileName1, "1\nb\nc\nd\ne\n6\n7\n8\n", _fileName2); IGitUICommandsSource uiCommandsSource = Substitute.For <IGitUICommandsSource>(); GitUICommands uiCommands = new(_referenceRepository.Module); uiCommandsSource.UICommands.Returns(x => uiCommands); _blameControl.UICommandsSource = uiCommandsSource; }