当前位置: 首页>>代码示例>>C#>>正文


C# Tree.FindBlobMember方法代码示例

本文整理汇总了C#中Tree.FindBlobMember方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.FindBlobMember方法的具体用法?C# Tree.FindBlobMember怎么用?C# Tree.FindBlobMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tree的用法示例。


在下文中一共展示了Tree.FindBlobMember方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: testRemoved

        public void testRemoved()
        {
            var index = new GitIndex(db);
            writeTrashFile("file2", "file2");
            writeTrashFile("dir/file3", "dir/file3");

            var t = new Tree(db);
            t.AddFile("file2");
            t.AddFile("dir/file3");
            Assert.AreEqual(2, t.MemberCount);
            t.FindBlobMember("file2").Id = ObjectId.FromString("30d67d4672d5c05833b7192cc77a79eaafb5c7ad");
            var tree2 = (Tree) t.findTreeMember("dir");
            tree2.FindBlobMember("file3").Id = ObjectId.FromString("873fb8d667d05436d728c52b1d7a09528e6eb59b");
            tree2.Id = new ObjectWriter(db).WriteTree(tree2);
            t.Id = new ObjectWriter(db).WriteTree(t);

            var diff = new IndexDiff(t, index);
            diff.Diff();
            Assert.AreEqual(2, diff.Removed.Count);
            Assert.IsTrue(diff.Removed.Contains("file2"));
            Assert.IsTrue(diff.Removed.Contains("dir/file3"));
            Assert.AreEqual(0, diff.Changed.Count);
            Assert.AreEqual(0, diff.Modified.Count);
            Assert.AreEqual(0, diff.Added.Count);
        }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:25,代码来源:IndexDiffTest.cs

示例2: test002_addFile

        public void test002_addFile()
        {
            var t = new Tree(db) { Id = SomeFakeId };
            Assert.IsTrue(t.Id != null);
            Assert.IsFalse(t.IsModified);

            const string n = "bob";
            FileTreeEntry f = t.AddFile(n);
            Assert.IsNotNull(f);
            Assert.AreEqual(n, f.Name);
            Assert.AreEqual(f.Name, Constants.CHARSET.GetString(f.NameUTF8));
            Assert.AreEqual(n, f.FullName);
            Assert.IsTrue(f.Id == null);
            Assert.IsTrue(t.IsModified);
            Assert.IsTrue(t.Id == null);
            Assert.IsTrue(t.FindBlobMember(f.Name) == f);

            TreeEntry[] i = t.Members;
            Assert.IsNotNull(i);
            Assert.IsTrue(i != null && i.Length > 0);
            Assert.IsTrue(i != null && i[0] == f);
            Assert.IsTrue(i != null && i.Length == 1);
        }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:23,代码来源:TreeTests.cs

示例3: test006_addDeepTree

        public void test006_addDeepTree()
        {
            var t = new Tree(db);

            Tree e = t.AddTree("e");
            Assert.IsNotNull(e);
            Assert.IsTrue(e.Parent == t);
            Tree f = t.AddTree("f");
            Assert.IsNotNull(f);
            Assert.IsTrue(f.Parent == t);
            Tree g = f.AddTree("g");
            Assert.IsNotNull(g);
            Assert.IsTrue(g.Parent == f);
            Tree h = g.AddTree("h");
            Assert.IsNotNull(h);
            Assert.IsTrue(h.Parent == g);

            h.Id = SomeFakeId;
            Assert.IsTrue(!h.IsModified);
            g.Id = SomeFakeId;
            Assert.IsTrue(!g.IsModified);
            f.Id = SomeFakeId;
            Assert.IsTrue(!f.IsModified);
            e.Id = SomeFakeId;
            Assert.IsTrue(!e.IsModified);
            t.Id = SomeFakeId;
            Assert.IsTrue(!t.IsModified);

            Assert.AreEqual("f/g/h", h.FullName);
            Assert.IsTrue(t.findTreeMember(h.FullName) == h);
            Assert.IsTrue(t.FindBlobMember("f/z") == null);
            Assert.IsTrue(t.FindBlobMember("y/z") == null);

            FileTreeEntry i = h.AddFile("i");
            Assert.IsNotNull(i);
            Assert.AreEqual("f/g/h/i", i.FullName);
            Assert.IsTrue(t.FindBlobMember(i.FullName) == i);
            Assert.IsTrue(h.IsModified);
            Assert.IsTrue(g.IsModified);
            Assert.IsTrue(f.IsModified);
            Assert.IsTrue(!e.IsModified);
            Assert.IsTrue(t.IsModified);

            Assert.IsTrue(h.Id == null);
            Assert.IsTrue(g.Id == null);
            Assert.IsTrue(f.Id == null);
            Assert.IsTrue(e.Id != null);
            Assert.IsTrue(t.Id == null);
        }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:49,代码来源:TreeTests.cs

示例4: test001_createEmpty

 public void test001_createEmpty()
 {
     var t = new Tree(db);
     Assert.IsTrue(t.IsLoaded);
     Assert.IsTrue(t.IsModified);
     Assert.IsTrue(t.Parent == null);
     Assert.IsTrue(t.IsRoot);
     Assert.IsTrue(t.Name == null);
     Assert.IsTrue(t.NameUTF8 == null);
     Assert.IsTrue(t.Members != null);
     Assert.IsTrue(t.Members.Length == 0);
     Assert.AreEqual(string.Empty, t.FullName);
     Assert.IsTrue(t.Id == null);
     Assert.IsTrue(t.TreeEntry == t);
     Assert.IsTrue(t.Repository == db);
     Assert.IsTrue(t.findTreeMember("foo") == null);
     Assert.IsTrue(t.FindBlobMember("foo") == null);
 }
开发者ID:HackerBaloo,项目名称:GitSharp,代码行数:18,代码来源:TreeTests.cs


注:本文中的Tree.FindBlobMember方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。