public void Metric_must_merge_2_metrics_that_are_tracking_the_same_metric()
{
for (var i = 1; i <= 20; i++)
{
var sample1 = _collector.Sample().Metrics;
var sample2 = _collector.Sample().Metrics;
var merged12 = sample1.Zip(sample2, (metric, metric1) => metric + metric1).ToList();
foreach (var latest in merged12)
{
Metric peer = null;
if (sample1.TryGetValue(latest, out peer))
{
var m = peer + latest;
Assert.Equal(latest.Value, m.Value);
Assert.True(m.IsSmooth == (peer.IsSmooth || latest.IsSmooth));
}
else
{
Assert.False(true, "Should have found set in collection");
}
}
var sample3 = _collector.Sample().Metrics;
var sample4 = _collector.Sample().Metrics;
var merged34 = sample3.Zip(sample4, (metric, metric1) => metric + metric1).ToList();
foreach (var latest in merged12)
{
Metric peer = null;
if (sample3.TryGetValue(latest, out peer))
{
var m = peer + latest;
Assert.Equal(latest.Value, m.Value);
Assert.True(m.IsSmooth == (peer.IsSmooth || latest.IsSmooth));
}
else
{
Assert.False(true, "Should have found set in collection");
}
}
}
}