< Summary - ReFlex - Library

Information
Class: ReFlex.Core.Calibration.Util.Calibration
Assembly: ReFlex.Core.Calibration
File(s): D:\a\reflex\reflex\library\src\Core\Calibration\Util\Calibration.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 34
Coverable lines: 34
Total lines: 88
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_SourceValues()100%210%
get_TargetValues()100%210%
get_UpperThreshold()100%210%
get_LowerThreshold()100%210%
get_LastUpdated()100%210%
GetCalibrationValuesString()0%2040%

File(s)

D:\a\reflex\reflex\library\src\Core\Calibration\Util\Calibration.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3
 4namespace ReFlex.Core.Calibration.Util
 5{
 6    /// <summary>
 7    /// Represents the result of a calibration process.
 8    /// The Mapping from the realworld values to the display values.
 9    /// </summary>
 10    public struct Calibration
 11    {
 12        /// <summary>
 13        /// Gets or sets the source values.
 14        /// </summary>
 15        /// <value>
 16        /// The source values.
 17        /// </value>
 018        public List<int[]> SourceValues { get; set; }
 19
 20        /// <summary>
 21        /// Gets or sets the target values.
 22        /// </summary>
 23        /// <value>
 24        /// The target values.
 25        /// </value>
 026        public List<int[]> TargetValues { get; set; }
 27
 28        /// <summary>
 29        /// Gets or sets the upper threshold.
 30        /// </summary>
 31        /// <value>
 32        /// The upper threshold.
 33        /// </value>
 034        public int UpperThreshold { get; set; }
 35
 36        /// <summary>
 37        /// Gets or sets the lower threshold.
 38        /// </summary>
 39        /// <value>
 40        /// The lower threshold.
 41        /// </value>
 042        public int LowerThreshold { get; set; }
 43
 44        /// <summary>
 45        /// Stores the time of the last Update (for update performance / usability reasons
 46        /// </summary>
 047        public List<DateTime> LastUpdated { get; set; }
 48
 49        public string GetCalibrationValuesString()
 050        {
 051            var result = $"=====  {nameof(Calibration)}  ====={Environment.NewLine}";
 052            result += $"  {nameof(LowerThreshold)}: {LowerThreshold} | ";
 053            result += $"  {nameof(UpperThreshold)}: {UpperThreshold}{Environment.NewLine}";
 54
 055            result += $"  {nameof(SourceValues)}: {Environment.NewLine}";
 56
 057            SourceValues.ForEach(val =>
 058            {
 059                result += "    [";
 060                Array.ForEach(val, current => result += $" {current} |");
 061                result = result.TrimEnd('|');
 062                result += $"]{Environment.NewLine}";
 063            });
 64
 065            result += $"  {nameof(TargetValues)}: {Environment.NewLine}";
 66
 067            TargetValues.ForEach(val =>
 068            {
 069                result += "    [";
 070                Array.ForEach(val, current => result += $" {current} |");
 071                result = result.TrimEnd('|');
 072                result += $"]{Environment.NewLine}";
 073            });
 74
 075            result += $"  {nameof(LastUpdated)}: [ ";
 76
 077            LastUpdated.ForEach(val =>
 078            {
 079                result += $" {val} |";
 080                result = result.TrimEnd('|');
 081            });
 82
 083            result += $" ]{Environment.NewLine}";
 84
 085            return result;
 086        }
 87    }
 88}