lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [10/46] lucenenet git commit: Fixed bug in Facet.Taxonomy.TestTaxonomyFacetCounts.TestBasic() where the output wasn't being written to because of a missing StreamWriter.
Date Tue, 04 Oct 2016 20:01:40 GMT
Fixed bug in Facet.Taxonomy.TestTaxonomyFacetCounts.TestBasic() where the output wasn't being
written to because of a missing StreamWriter.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/2b718fb4
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/2b718fb4
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/2b718fb4

Branch: refs/heads/master
Commit: 2b718fb47402f644b304c2e1c6ce6e617d08327d
Parents: e9302a8
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sat Sep 24 22:42:56 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Oct 3 23:30:54 2016 +0700

----------------------------------------------------------------------
 .../Taxonomy/TestTaxonomyFacetCounts.cs               | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2b718fb4/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
index e4ddc51..51d0794 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
@@ -50,6 +50,8 @@ namespace Lucene.Net.Facet.Taxonomy
     using Directory = Lucene.Net.Store.Directory;
     using IOUtils = Lucene.Net.Util.IOUtils;
     using TestUtil = Lucene.Net.Util.TestUtil;
+    using System.Text;
+
     [TestFixture]
     public class TestTaxonomyFacetCounts : FacetTestCase
     {
@@ -128,9 +130,15 @@ namespace Lucene.Net.Facet.Taxonomy
             Assert.Null(facets.GetTopChildren(10, "Non exitent dim"));
 
             // Smoke test PrintTaxonomyStats:
-            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-            PrintTaxonomyStats.PrintStats(taxoReader, Console.Out, true);
-            string result = bos.ToString();
+            string result;
+            using (ByteArrayOutputStream bos = new ByteArrayOutputStream())
+            {
+                using (StreamWriter w = new StreamWriter(bos, Encoding.UTF8, 2048, true)
{ AutoFlush = true })
+                {
+                    PrintTaxonomyStats.PrintStats(taxoReader, w, true);
+                }
+                result = bos.ToString();
+            }
             Assert.True(result.IndexOf("/Author: 4 immediate children; 5 total categories",
StringComparison.Ordinal) != -1);
             Assert.True(result.IndexOf("/Publish Date: 3 immediate children; 12 total categories",
StringComparison.Ordinal) != -1);
             // Make sure at least a few nodes of the tree came out:


Mime
View raw message