public void TestHitCountSampleCombiner() { var hitCountSample = new DataSample { HitCount = 1, SampleType = DataSampleType.HitCount, StartTime = this.start.ToMillisecondTimestamp(), EndTime = this.end.ToMillisecondTimestamp() }; var combiner = new SampleCombiner(hitCountSample); for (uint i = 0; i < 100; i++) { var before = (combiner.Data).HitCount; combiner.AddSample(new DataSample { HitCount = i, SampleType = DataSampleType.HitCount, StartTime = this.start.ToMillisecondTimestamp(), EndTime = this.end.ToMillisecondTimestamp() }); Assert.AreEqual(before + i, (combiner.Data).HitCount); } }
public void TestHitCountSampleCombiner() { var hitCountSample = new DataSample { HitCount = 1, SampleType = DataSampleType.HitCount, StartTime = this.start.ToMillisecondTimestamp(), EndTime = this.end.ToMillisecondTimestamp() }; var combiner = new SampleCombiner(hitCountSample); for (uint i = 0; i < 100; i++) { var before = (combiner.Data).HitCount; combiner.AddSample(new DataSample { HitCount = i, SampleType = DataSampleType.HitCount, StartTime = this.start.ToMillisecondTimestamp(), EndTime = this.end.ToMillisecondTimestamp() }); Assert.AreEqual(before + i, (combiner.Data).HitCount); } }
public void SampleCombinerMergesTimeRanges() { var now = DateTime.Now; var today = new DateTime(now.Year, now.Month, now.Day); var yesterday = today.AddDays(-1); var tomorrow = today.AddDays(1); var firstSample = new DataSample { HitCount = 1, SampleType = DataSampleType.HitCount, StartTime = yesterday.ToMillisecondTimestamp(), EndTime = today.ToMillisecondTimestamp() }; var secondSample = new DataSample { HitCount = 1, SampleType = DataSampleType.HitCount, StartTime = today.ToMillisecondTimestamp(), EndTime = tomorrow.ToMillisecondTimestamp() }; var combiner = new SampleCombiner(firstSample); combiner.AddSample(secondSample); Assert.AreEqual(yesterday.ToMillisecondTimestamp(), combiner.Data.StartTime); Assert.AreEqual(tomorrow.ToMillisecondTimestamp(), combiner.Data.EndTime); }
public void SampleCombinerMergesTimeRanges() { var now = DateTime.Now; var today = new DateTime(now.Year, now.Month, now.Day); var yesterday = today.AddDays(-1); var tomorrow = today.AddDays(1); var firstSample = new DataSample { HitCount = 1, SampleType = DataSampleType.HitCount, StartTime = yesterday.ToMillisecondTimestamp(), EndTime = today.ToMillisecondTimestamp() }; var secondSample = new DataSample { HitCount = 1, SampleType = DataSampleType.HitCount, StartTime = today.ToMillisecondTimestamp(), EndTime = tomorrow.ToMillisecondTimestamp() }; var combiner = new SampleCombiner(firstSample); combiner.AddSample(secondSample); Assert.AreEqual(yesterday.ToMillisecondTimestamp(), combiner.Data.StartTime); Assert.AreEqual(tomorrow.ToMillisecondTimestamp(), combiner.Data.EndTime); }