public void TestAllValues() { var index = 0; long latestValueAtIndex = 0; // Iterate raw data by stepping through every value that ahs a count recorded: foreach (var v in RawHistogram.AllValues()) { var countAddedInThisBucket = v.CountAddedInThisIterationStep; if (index == 1000) { Assert.AreEqual(10000, countAddedInThisBucket, "Raw AllValues bucket # 0 added a count of 10000"); } else if (LongHistogram.ValuesAreEquivalent(v.ValueIteratedTo, 100000000)) { Assert.AreEqual(1, countAddedInThisBucket, "Raw AllValues value bucket # " + index + " added a count of 1"); } else { Assert.AreEqual(0, countAddedInThisBucket, "Raw AllValues value bucket # " + index + " added a count of 0"); } latestValueAtIndex = v.ValueIteratedTo; index++; } Assert.AreEqual(1, RawHistogram.GetCountAtValue(latestValueAtIndex), "Count at latest value iterated to is 1"); index = 0; long totalAddedCounts = 0; // Iterate data using linear buckets of 1 sec each. foreach (var v in LongHistogram.AllValues()) { var countAddedInThisBucket = v.CountAddedInThisIterationStep; if (index == 1000) { Assert.AreEqual(10000, countAddedInThisBucket, $"AllValues bucket # 0 [{v.ValueIteratedFrom}..{v.ValueIteratedTo}] added a count of 10000"); } Assert.AreEqual(v.CountAtValueIteratedTo, v.CountAddedInThisIterationStep, $"The count in AllValues 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"); }