public void Using_external_histogram_for_recycling_throws()
        {
            var externallyCreatedHistogram = new LongHistogram(HighestTrackableValue, 3);
            var recorder = new Recorder(1, HighestTrackableValue, NumberOfSignificantValueDigits, (id, lowest, highest, sf) => new LongHistogram(id, lowest, highest, sf));
            recorder.RecordValue(1000);

            Assert.Throws<InvalidOperationException>(() => recorder.GetIntervalHistogram(externallyCreatedHistogram));

            recorder.GetIntervalHistogramInto(externallyCreatedHistogram);
        }
        public void GetIntervalHistogramInto_copies_data_over_provided_Histogram()
        {
            var originalStart = DateTime.Today.AddDays(-1).MillisecondsSinceUnixEpoch();
            var originalEnd = DateTime.Today.MillisecondsSinceUnixEpoch();
            var targetHistogram = new LongHistogram(1, HighestTrackableValue, 3);
            targetHistogram.StartTimeStamp = originalStart;
            targetHistogram.RecordValue(1);
            targetHistogram.RecordValue(10);
            targetHistogram.RecordValue(100);
            targetHistogram.EndTimeStamp = originalEnd;


            Assert.AreEqual(3, targetHistogram.TotalCount);
            Assert.AreEqual(1, targetHistogram.GetCountAtValue(1));
            Assert.AreEqual(1, targetHistogram.GetCountAtValue(10));
            Assert.AreEqual(1, targetHistogram.GetCountAtValue(100));

            var recorder = new Recorder(1, HighestTrackableValue, NumberOfSignificantValueDigits, (id, lowest, highest, sf) => new LongHistogram(id, lowest, highest, sf));
            recorder.RecordValue(1000);
            recorder.RecordValue(10000);
            recorder.RecordValue(100000);
            
            recorder.GetIntervalHistogramInto(targetHistogram);
            
            Assert.AreEqual(3, targetHistogram.TotalCount);
            Assert.AreEqual(0, targetHistogram.GetCountAtValue(1));
            Assert.AreEqual(0, targetHistogram.GetCountAtValue(10));
            Assert.AreEqual(0, targetHistogram.GetCountAtValue(100));
            Assert.AreEqual(1, targetHistogram.GetCountAtValue(1000));
            Assert.AreEqual(1, targetHistogram.GetCountAtValue(10000));
            Assert.AreEqual(1, targetHistogram.GetCountAtValue(100000));
            Assert.AreNotEqual(originalStart, targetHistogram.StartTimeStamp);
            Assert.AreNotEqual(originalEnd, targetHistogram.EndTimeStamp);
        }