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


C# FileTreeIterator.CreateSubtreeIterator方法代码示例

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


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

示例1: TestSimpleIterate

		public virtual void TestSimpleIterate()
		{
			FileTreeIterator top = new FileTreeIterator(trash, db.FileSystem, ((FileBasedConfig
				)db.GetConfig()).Get(WorkingTreeOptions.KEY));
			NUnit.Framework.Assert.IsTrue(top.First);
			NUnit.Framework.Assert.IsFalse(top.Eof);
			NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE.GetBits(), top.mode);
			NUnit.Framework.Assert.AreEqual(paths[0], NameOf(top));
			NUnit.Framework.Assert.AreEqual(paths[0].Length, top.GetEntryLength());
			NUnit.Framework.Assert.AreEqual(mtime[0], top.GetEntryLastModified());
			top.Next(1);
			NUnit.Framework.Assert.IsFalse(top.First);
			NUnit.Framework.Assert.IsFalse(top.Eof);
			NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE.GetBits(), top.mode);
			NUnit.Framework.Assert.AreEqual(paths[1], NameOf(top));
			NUnit.Framework.Assert.AreEqual(paths[1].Length, top.GetEntryLength());
			NUnit.Framework.Assert.AreEqual(mtime[1], top.GetEntryLastModified());
			top.Next(1);
			NUnit.Framework.Assert.IsFalse(top.First);
			NUnit.Framework.Assert.IsFalse(top.Eof);
			NUnit.Framework.Assert.AreEqual(FileMode.TREE.GetBits(), top.mode);
			ObjectReader reader = db.NewObjectReader();
			AbstractTreeIterator sub = top.CreateSubtreeIterator(reader);
			NUnit.Framework.Assert.IsTrue(sub is FileTreeIterator);
			FileTreeIterator subfti = (FileTreeIterator)sub;
			NUnit.Framework.Assert.IsTrue(sub.First);
			NUnit.Framework.Assert.IsFalse(sub.Eof);
			NUnit.Framework.Assert.AreEqual(paths[2], NameOf(sub));
			NUnit.Framework.Assert.AreEqual(paths[2].Length, subfti.GetEntryLength());
			NUnit.Framework.Assert.AreEqual(mtime[2], subfti.GetEntryLastModified());
			sub.Next(1);
			NUnit.Framework.Assert.IsTrue(sub.Eof);
			top.Next(1);
			NUnit.Framework.Assert.IsFalse(top.First);
			NUnit.Framework.Assert.IsFalse(top.Eof);
			NUnit.Framework.Assert.AreEqual(FileMode.REGULAR_FILE.GetBits(), top.mode);
			NUnit.Framework.Assert.AreEqual(paths[3], NameOf(top));
			NUnit.Framework.Assert.AreEqual(paths[3].Length, top.GetEntryLength());
			NUnit.Framework.Assert.AreEqual(mtime[3], top.GetEntryLastModified());
			top.Next(1);
			NUnit.Framework.Assert.IsTrue(top.Eof);
		}
开发者ID:LunarLanding,项目名称:ngit,代码行数:42,代码来源:FileTreeIteratorTest.cs


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