public void TestRecordedValues() { var index = 0; // Iterate raw data by stepping through every value that has a count recorded: foreach (var v in RawHistogram.RecordedValues()) { var countAddedInThisBucket = v.CountAddedInThisIterationStep; if (index == 0) { Assert.AreEqual(10000, countAddedInThisBucket, "Raw recorded value bucket # 0 added a count of 10000"); } else { Assert.AreEqual(1, countAddedInThisBucket, "Raw recorded value bucket # " + index + " added a count of 1"); } index++; } Assert.AreEqual(2, index); index = 0; long totalAddedCounts = 0; // Iterate data using linear buckets of 1 sec each. foreach (var v in LongHistogram.RecordedValues()) { var countAddedInThisBucket = v.CountAddedInThisIterationStep; if (index == 0) { Assert.AreEqual(10000, countAddedInThisBucket, $"Recorded bucket # 0 [{v.ValueIteratedFrom}..{v.ValueIteratedTo}] added a count of 10000"); } Assert.That(v.CountAtValueIteratedTo != 0, $"The count in recorded bucket #{index} is not 0"); Assert.AreEqual(v.CountAtValueIteratedTo, v.CountAddedInThisIterationStep, $"The count in recorded bucket #{index} is exactly the amount added since the last iteration"); totalAddedCounts += v.CountAddedInThisIterationStep; index++; } Assert.AreEqual(20000, totalAddedCounts, "Total added counts should be 20000"); }