コード例 #1
0
        public void TestGetChangesNewlineAddedToEndOfFile()
        {
            string             repoDir            = TestUtils.ExtractZippedRepo("html-generator.git");
            RepositoryAnalyzer repositoryAnalyzer = new RepositoryAnalyzer(repoDir);
            CommitDelta        changes            = repositoryAnalyzer.GetChanges("54a1f0028d595e73ea3151459cb7f9e58ec46b0b");
            FileChange         portfileChanges    = changes.Modified.Where(x => x.Path == @"src\src\HtmlGenerator\Tag.cs").First();

            Assert.AreEqual(1, portfileChanges.NumberOfLinesDeleted);
            Assert.AreEqual(2, portfileChanges.NumberOfLinesAdded);
        }
コード例 #2
0
        public void TestGetChangesByCommitTwoParentsNoChange()
        {
            string             repoDir            = TestUtils.ExtractZippedRepo("csharplang.git");
            RepositoryAnalyzer repositoryAnalyzer = new RepositoryAnalyzer(repoDir);
            CommitDelta        changes            = repositoryAnalyzer.GetChanges("dfb46ac110aacfade7a4a9491b272e6e8ffc4468");

            Assert.AreEqual(0, changes.Added.Count);
            Assert.AreEqual(0, changes.Deleted.Count);
            Assert.AreEqual(0, changes.Modified.Count);
        }
コード例 #3
0
        public void TestGetChangesByCommitTwoParentsWithChange()
        {
            string             repoDir            = TestUtils.ExtractZippedRepo("vcpkg.git");
            RepositoryAnalyzer repositoryAnalyzer = new RepositoryAnalyzer(repoDir);
            CommitDelta        changes            = repositoryAnalyzer.GetChanges("dbab03a1a82913ae96bfa3c1613ade20b5ac438d");

            Assert.AreEqual(0, changes.Added.Count);
            Assert.AreEqual(0, changes.Deleted.Count);
            Assert.AreEqual(1, changes.Modified.Count);
            FileChange portfileChanges = changes.Modified.Where(x => x.Path == @"ports\openssl\portfile.cmake").First();

            Assert.AreEqual(1, portfileChanges.NumberOfLinesDeleted);
            Assert.AreEqual(0, portfileChanges.NumberOfLinesAdded);
        }
コード例 #4
0
        public void TestGetChangesByCommitOneParentFilesModified()
        {
            string             repoDir            = TestUtils.ExtractZippedRepo("csharplang.git");
            RepositoryAnalyzer repositoryAnalyzer = new RepositoryAnalyzer(repoDir);
            CommitDelta        changes            = repositoryAnalyzer.GetChanges("a5f82604eab5826bd1913cf63c7dfb8c2b187641");

            Assert.AreEqual(0, changes.Added.Count);
            Assert.AreEqual(0, changes.Deleted.Count);
            Assert.AreEqual(2, changes.Modified.Count);
            FileChange readmeChanges = changes.Modified.Where(x => x.Path == @"README.md").First();

            Assert.AreEqual(4, readmeChanges.NumberOfLinesDeleted);
            Assert.AreEqual(12, readmeChanges.NumberOfLinesAdded);
            FileChange proposalsReadmeChanges = changes.Modified.Where(x => x.Path == @"proposals\README.md").First();

            Assert.AreEqual(1, proposalsReadmeChanges.NumberOfLinesAdded);
            Assert.AreEqual(1, proposalsReadmeChanges.NumberOfLinesDeleted);
        }
コード例 #5
0
        public void TestGetChangesByCommitOneParentFilesAdded()
        {
            string             repoDir            = TestUtils.ExtractZippedRepo("csharplang.git");
            RepositoryAnalyzer repositoryAnalyzer = new RepositoryAnalyzer(repoDir);
            CommitDelta        changes            = repositoryAnalyzer.GetChanges("7981ea1fb4d89571fd41e3b75f7c9f7fc178e837");

            Assert.AreEqual(2, changes.Added.Count);
            Assert.AreEqual(0, changes.Deleted.Count);
            Assert.AreEqual(0, changes.Modified.Count);
            FileChange nullableChanges = changes.Added.Where(x => x.Path == @"proposals\nullable-reference-types.md").First();

            Assert.AreEqual(0, nullableChanges.NumberOfLinesDeleted);
            Assert.AreEqual(126, nullableChanges.NumberOfLinesAdded);
            FileChange notesChanges = changes.Added.Where(x => x.Path == @"design-notes\Notes-2016-11-16.md").First();

            Assert.AreEqual(0, notesChanges.NumberOfLinesDeleted);
            Assert.AreEqual(74, notesChanges.NumberOfLinesAdded);
        }