本文整理汇总了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();
}
}
示例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 + ".");
}
}
示例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()
);
}
示例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()
);
}
示例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);
}