Пример #1
0
        /// <inheritdoc/>
        public void Visit(SingleValueMetric metric)
        {
            Ensure.ArgumentNotNull(metric, "metric");

            string result = SingleValueFormatter.Output(metric.Name, metric.UnitOfMeasurement, metric.GetValue());
            writer.WriteLine(result);
        }
Пример #2
0
        protected string GetOutput(IOutputStrategy outputStrategy)
        {
            var single = new SingleValueMetric("single", data => data.Sum())
            {
                DataProvider = sample => sample.Ticks,
                Samples = new List<TimeSpan> { new TimeSpan(100) },
                UnitOfMeasurement = "ticks"
            };

            var multiple = new MultipleValueMetric("multiple", data => data)
            {
                DataProvider = sample => sample.Ticks,
                Samples = new List<TimeSpan> { new TimeSpan(50), new TimeSpan(75) },
                UnitOfMeasurement = "ticks"
            };

            var metrics = new List<IMetric> { single, multiple };

            using (var writer = new StringWriter())
            {
                outputStrategy.Execute(writer, metrics);
                return writer.ToString();
            }
        }
Пример #3
0
 /// <inheritdoc/>
 public void Visit(SingleValueMetric metric)
 {
     Ensure.ArgumentNotNull(metric, "metric");
     writer.WriteElementString(metric.Name, metric.GetValue());
 }