當前位置: 首頁>>代碼示例>>C#>>正文


C# Tree.MemberCount方法代碼示例

本文整理匯總了C#中NGit.Tree.MemberCount方法的典型用法代碼示例。如果您正苦於以下問題:C# Tree.MemberCount方法的具體用法?C# Tree.MemberCount怎麽用?C# Tree.MemberCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在NGit.Tree的用法示例。


在下文中一共展示了Tree.MemberCount方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: FinishVisitTree

 /// <exception cref="System.IO.IOException"></exception>
 public override void FinishVisitTree(Tree tree, int i, string curDir)
 {
     if (tree.MemberCount() == 0)
     {
         NUnit.Framework.Assert.Fail();
     }
     if (i == 0)
     {
         NUnit.Framework.Assert.Fail();
     }
 }
開發者ID:charles-cai,項目名稱:ngit,代碼行數:12,代碼來源:IndexTreeWalkerTest.cs

示例2: Test007_manyFileLookup

		public virtual void Test007_manyFileLookup()
		{
			Tree t = new Tree(db);
			IList<FileTreeEntry> files = new AList<FileTreeEntry>(26 * 26);
			for (char level1 = 'a'; level1 <= 'z'; level1++)
			{
				for (char level2 = 'a'; level2 <= 'z'; level2++)
				{
					string n = "." + level1 + level2 + "9";
					FileTreeEntry f = t.AddFile(n);
					NUnit.Framework.Assert.IsNotNull(f, "File " + n + " added.");
					NUnit.Framework.Assert.AreEqual(n, f.GetName());
					files.AddItem(f);
				}
			}
			NUnit.Framework.Assert.AreEqual(files.Count, t.MemberCount());
			TreeEntry[] ents = t.Members();
			NUnit.Framework.Assert.IsNotNull(ents);
			NUnit.Framework.Assert.AreEqual(files.Count, ents.Length);
			for (int k = 0; k < ents.Length; k++)
			{
				NUnit.Framework.Assert.IsTrue(files[k] == ents[k], "File " + files[k].GetName() +
					 " is at " + k + ".");
			}
		}
開發者ID:LunarLanding,項目名稱:ngit,代碼行數:25,代碼來源:T0002_TreeTest.cs

示例3: TestModified

 public virtual void TestModified()
 {
     WriteTrashFile("file2", "file2");
     WriteTrashFile("dir/file3", "dir/file3");
     Git git = new Git(db);
     git.Add().AddFilepattern("file2").AddFilepattern("dir/file3").Call();
     WriteTrashFile("dir/file3", "changed");
     Tree tree = new Tree(db);
     tree.AddFile("file2").SetId(ObjectId.FromString("0123456789012345678901234567890123456789"
         ));
     tree.AddFile("dir/file3").SetId(ObjectId.FromString("0123456789012345678901234567890123456789"
         ));
     NUnit.Framework.Assert.AreEqual(2, tree.MemberCount());
     Tree tree2 = (Tree)tree.FindTreeMember("dir");
     tree2.SetId(InsertTree(tree2));
     tree.SetId(InsertTree(tree));
     FileTreeIterator iterator = new FileTreeIterator(db);
     IndexDiff diff = new IndexDiff(db, tree.GetId(), iterator);
     diff.Diff();
     NUnit.Framework.Assert.AreEqual(2, diff.GetChanged().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetChanged().Contains("file2"));
     NUnit.Framework.Assert.IsTrue(diff.GetChanged().Contains("dir/file3"));
     NUnit.Framework.Assert.AreEqual(1, diff.GetModified().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetModified().Contains("dir/file3"));
     NUnit.Framework.Assert.AreEqual(0, diff.GetAdded().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetRemoved().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetMissing().Count);
     NUnit.Framework.CollectionAssert.AreEquivalent(Collections<string>.EMPTY_SET, diff.GetUntrackedFolders()
         );
 }
開發者ID:sharwell,項目名稱:ngit,代碼行數:30,代碼來源:IndexDiffTest.cs

示例4: TestRemoved

 public virtual void TestRemoved()
 {
     WriteTrashFile("file2", "file2");
     WriteTrashFile("dir/file3", "dir/file3");
     Tree tree = new Tree(db);
     tree.AddFile("file2");
     tree.AddFile("dir/file3");
     NUnit.Framework.Assert.AreEqual(2, tree.MemberCount());
     tree.FindBlobMember("file2").SetId(ObjectId.FromString("30d67d4672d5c05833b7192cc77a79eaafb5c7ad"
         ));
     Tree tree2 = (Tree)tree.FindTreeMember("dir");
     tree2.FindBlobMember("file3").SetId(ObjectId.FromString("873fb8d667d05436d728c52b1d7a09528e6eb59b"
         ));
     tree2.SetId(InsertTree(tree2));
     tree.SetId(InsertTree(tree));
     FileTreeIterator iterator = new FileTreeIterator(db);
     IndexDiff diff = new IndexDiff(db, tree.GetId(), iterator);
     diff.Diff();
     NUnit.Framework.Assert.AreEqual(2, diff.GetRemoved().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetRemoved().Contains("file2"));
     NUnit.Framework.Assert.IsTrue(diff.GetRemoved().Contains("dir/file3"));
     NUnit.Framework.Assert.AreEqual(0, diff.GetChanged().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetModified().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetAdded().Count);
     NUnit.Framework.CollectionAssert.AreEquivalent(Collections<string>.EMPTY_SET, diff.GetUntrackedFolders()
         );
 }
開發者ID:sharwell,項目名稱:ngit,代碼行數:27,代碼來源:IndexDiffTest.cs

示例5: TestModified

 public virtual void TestModified()
 {
     GitIndex index = new GitIndex(db);
     index.Add(trash, WriteTrashFile("file2", "file2"));
     index.Add(trash, WriteTrashFile("dir/file3", "dir/file3"));
     index.Write();
     WriteTrashFile("dir/file3", "changed");
     Tree tree = new Tree(db);
     tree.AddFile("file2").SetId(ObjectId.FromString("0123456789012345678901234567890123456789"
         ));
     tree.AddFile("dir/file3").SetId(ObjectId.FromString("0123456789012345678901234567890123456789"
         ));
     NUnit.Framework.Assert.AreEqual(2, tree.MemberCount());
     Tree tree2 = (Tree)tree.FindTreeMember("dir");
     tree2.SetId(InsertTree(tree2));
     tree.SetId(InsertTree(tree));
     FileTreeIterator iterator = new FileTreeIterator(db);
     IndexDiff diff = new IndexDiff(db, tree.GetId(), iterator);
     diff.Diff();
     NUnit.Framework.Assert.AreEqual(2, diff.GetChanged().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetChanged().Contains("file2"));
     NUnit.Framework.Assert.IsTrue(diff.GetChanged().Contains("dir/file3"));
     NUnit.Framework.Assert.AreEqual(1, diff.GetModified().Count);
     NUnit.Framework.Assert.IsTrue(diff.GetModified().Contains("dir/file3"));
     NUnit.Framework.Assert.AreEqual(0, diff.GetAdded().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetRemoved().Count);
     NUnit.Framework.Assert.AreEqual(0, diff.GetMissing().Count);
 }
開發者ID:ashmind,項目名稱:ngit,代碼行數:28,代碼來源:IndexDiffTest.cs


注:本文中的NGit.Tree.MemberCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。