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"),
            });
        }
Ejemplo n.º 2
0
 public TestAccessor(BlameControl control)
 {
     _control = control;
 }
Ejemplo n.º 3
0
        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;
        }