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


C# IEnumerator.HasNext方法代码示例

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


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

示例1: CopyStreamsToFolder

 /// <exception cref="System.IO.IOException"></exception>
 public static void CopyStreamsToFolder(IEnumerator<KeyValuePair<string, InputStream     >> streams, FilePath folder)
 {
     while (streams.HasNext())
     {
         KeyValuePair<string, InputStream> entry = streams.Next();
         FilePath file = new FilePath(folder, entry.Key);
         CopyStreamToFile(entry.Value, file);
     }
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:10,代码来源:StreamUtils.cs

示例2: TestFieldNonExistent

        public void TestFieldNonExistent()
        {
            try
            {
                indexReader = IndexReader.Open(store);

                ld = new LuceneDictionary(indexReader, "nonexistent_field");
                it = ld.GetWordsIterator();

                AssertFalse("More elements than expected", it.HasNext());
                AssertTrue("Nonexistent element is really null", it.Next() == null);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:17,代码来源:TestLuceneDictionary.cs

示例3: TestFieldAaa

        public void TestFieldAaa()
        {
            try
            {
                indexReader = IndexReader.Open(store);

                ld = new LuceneDictionary(indexReader, "aaa");
                it = ld.GetWordsIterator();

                AssertTrue("First element doesn't exist.", it.HasNext());
                AssertTrue("First element isn't correct", it.Next().Equals("foo"));
                AssertFalse("More elements than expected", it.HasNext());
                AssertTrue("Nonexistent element is really null", it.Next() == null);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:19,代码来源:TestLuceneDictionary.cs

示例4: TestFieldContents_2

        public void TestFieldContents_2()
        {
            try
            {
                indexReader = IndexReader.Open(store);

                ld = new LuceneDictionary(indexReader, "contents");
                it = ld.GetWordsIterator();
                
                // hasNext() should have no side effects //{{DIGY}} But has. Need a fix?
                //AssertTrue("First element isn't were it should be.", it.HasNext());
                //AssertTrue("First element isn't were it should be.", it.HasNext());
                //AssertTrue("First element isn't were it should be.", it.HasNext());

                // just iterate through words
                AssertTrue("First element isn't correct", it.Next().Equals("Jerry"));
                AssertTrue("Second element isn't correct", it.Next().Equals("Tom"));
                AssertTrue("Nonexistent element is really null", it.Next() == null);

                // hasNext() should still have no side effects ...
                AssertFalse("There should be any more elements", it.HasNext());
                AssertFalse("There should be any more elements", it.HasNext());
                AssertFalse("There should be any more elements", it.HasNext());

                // .. and there are really no more words
                AssertTrue("Nonexistent element is really null", it.Next() == null);
                AssertTrue("Nonexistent element is really null", it.Next() == null);
                AssertTrue("Nonexistent element is really null", it.Next() == null);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:34,代码来源:TestLuceneDictionary.cs

示例5: TestFieldContents_1

        public void TestFieldContents_1()
        {
            try
            {
                indexReader = IndexReader.Open(store);

                ld = new LuceneDictionary(indexReader, "contents");
                it = ld.GetWordsIterator();

                AssertTrue("First element doesn't exist.", it.HasNext());
                AssertTrue("First element isn't correct", it.Next().Equals("Jerry"));
                AssertTrue("Second element doesn't exist.", it.HasNext());
                AssertTrue("Second element isn't correct", it.Next().Equals("Tom"));
                AssertFalse("More elements than expected", it.HasNext());
                AssertTrue("Nonexistent element is really null", it.Next() == null);

                ld = new LuceneDictionary(indexReader, "contents");
                it = ld.GetWordsIterator();

                int counter = 2;
                while (it.HasNext())
                {
                    it.Next();
                    counter--;
                }

                AssertTrue("Number of words incorrect", counter == 0);
            }
            finally
            {
                if (indexReader != null) { indexReader.Close(); }
            }
        }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:33,代码来源:TestLuceneDictionary.cs

示例6: CompareIterators

		private void CompareIterators(IEnumerator it1, IEnumerator it2)
		{
			while (it1.HasNext())
			{
				NUnit.Framework.Assert.AreEqual(it1.Next(), it2.Next());
			}
			NUnit.Framework.Assert.IsFalse(it2.HasNext());
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:8,代码来源:Bug466207Test.cs

示例7: CompareIterators

		private void CompareIterators(IEnumerator it1, IEnumerator it2)
		{
			NUnit.Framework.Assert.IsTrue(map.Count == 4);
			while (it1.HasNext())
			{
				NUnit.Framework.Assert.AreEqual(it1.Next(), it2.Next());
				it1.Remove();
				it2.Remove();
			}
			NUnit.Framework.Assert.IsTrue(map.IsEmpty());
		}
开发者ID:hazzik,项目名称:Rhino.Net,代码行数:11,代码来源:Bug448816Test.cs


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