示例#1
0
        private void VerifyThisIsATest(BigramHistogramReport histogramReport)
        {
            Assert.True(histogramReport.OriginalString == testString);
            Assert.True(histogramReport.Domain.Count == expectedBigramCount, $"# of bigrams = {histogramReport.Domain.Count} but should be {expectedBigramCount}");
            Assert.True(histogramReport.Histogram.Buckets.Count == expectedBucketCount, $"# of buckets = {histogramReport.Histogram.Buckets.Count} but should be {expectedBucketCount}");

            Assert.True(histogramReport.Histogram.Buckets[0].Value == "This is");
            Assert.True(histogramReport.Histogram.Buckets[1].Value == "is a");
            Assert.True(histogramReport.Histogram.Buckets[2].Value == "a test");
            Assert.True(histogramReport.Histogram.Buckets[3].Value == "test is");

            Assert.True(histogramReport.Histogram.Buckets[0].Count == 1);
            Assert.True(histogramReport.Histogram.Buckets[1].Count == 2);
            Assert.True(histogramReport.Histogram.Buckets[2].Count == 2);
            Assert.True(histogramReport.Histogram.Buckets[3].Count == 1);
        }
示例#2
0
        private string[] PrepareConsoleOutput(BigramHistogramReport report)
        {
            var consoleOutput = report.Histogram.Buckets.OrderByDescending(x => x.Count).Select(x => x.Value + " => " + x.Count.ToString()).ToArray();

            return(consoleOutput);
        }