Exemple #1
0
        public Metric ConvertTo()
        {
            var metric = new Metric(Name, Unit);

            foreach (var value in Values)
            {
                metric.AddValue(value.ConvertTo());
            }

            return(metric);
        }
Exemple #2
0
        private IEnumerable <Metric> GetMetrics111()
        {
            var values1 = new Collection <Value>
            {
                NewValue(50, new DateTime(2020, 01, 01)),
                NewValue(52, new DateTime(2020, 01, 02)),
            };

            var values2 = new Collection <Value>
            {
                NewValue(101, new DateTime(2020, 02, 01)),
                NewValue(105, new DateTime(2020, 02, 02)),
                NewValue(110, new DateTime(2020, 02, 03)),
            };

            var metric1 = new Metric("Weight", "Kg");

            metric1.UpdateSource(Source);
            foreach (var val in values1)
            {
                metric1.AddValue(val);
            }

            var metric2 = new Metric("Growth", "Cm");

            metric2.UpdateSource(Source);
            foreach (var val in values2)
            {
                metric2.AddValue(val);
            }

            return(new List <Metric>()
            {
                metric1, metric2
            });
        }