< Summary - pva.SuperV

Information
Class: pva.SuperV.Engine.HistoryStorage.HistoryRepository
Assembly: pva.SuperV.Engine
File(s): /home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Engine/HistoryStorage/HistoryRepository.cs
Tag: dotnet-ubuntu_18869653307
Line coverage
85%
Covered lines: 12
Uncovered lines: 2
Coverable lines: 14
Total lines: 73
Line coverage: 85.7%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
get_Name()100%11100%
get_HistoryStorageEngine()100%11100%
get_HistoryStorageId()100%11100%
UpsertRepository(...)100%11100%
UpsertClassTimeSerie(...)50%2266.66%
HistorizeValues(...)50%22100%

File(s)

/home/runner/work/pva.SuperV/pva.SuperV/pva.SuperV.Engine/HistoryStorage/HistoryRepository.cs

#LineLine coverage
 1using pva.SuperV.Engine.Exceptions;
 2using pva.SuperV.Engine.Processing;
 3using System.Text.Json.Serialization;
 4
 5namespace pva.SuperV.Engine.HistoryStorage
 6{
 7    /// <summary>
 8    /// History repository to store history of instance values.
 9    /// </summary>
 15810    public class HistoryRepository(string name)
 11    {
 12        /// <summary>
 13        /// Gets the history repository name.
 14        /// </summary>
 15        /// <value>
 16        /// The name.
 17        /// </value>
 89118        public string Name { get; } = IdentifierValidation.ValidateIdentifier("history repository", name);
 19
 20        /// <summary>
 21        /// Gets or sets the history storage engine used to store values.
 22        /// </summary>
 23        /// <value>
 24        /// The history storage engine.
 25        /// </value>
 26        [JsonIgnore]
 77427        public IHistoryStorageEngine? HistoryStorageEngine { get; set; }
 28
 29        /// <summary>
 30        /// Gets of sets the history storage ID.
 31        /// </summary>
 32        /// <value> The history storage ID</value>
 37933        public string? HistoryStorageId { get; set; }
 34
 35        /// <summary>
 36        /// Upserts the repository in storage engine.
 37        /// </summary>
 38        /// <param name="projectName">Name of project.</param>
 39        /// <param name="historyStorageEngine">History storage engine.</param>
 40        internal void UpsertRepository(string projectName, IHistoryStorageEngine historyStorageEngine) =>
 11141            HistoryStorageId = historyStorageEngine.UpsertRepository(projectName, this);
 42
 43        /// <summary>
 44        /// Upserts a time series in storage engine.
 45        /// </summary>
 46        /// <typeparam name="T"></typeparam>
 47        /// <param name="projectName">Name of project.</param>
 48        /// <param name="className">Name of class.</param>
 49        /// <param name="historizationProcessing">History processing for which the time series is to be created.</param>
 50        /// <returns></returns>
 51        /// <exception cref="NoHistoryStorageEngineException"></exception>
 52        internal string UpsertClassTimeSerie<T>(string projectName, string className, HistorizationProcessing<T> histori
 22053        {
 22054            if (HistoryStorageEngine is null)
 055            {
 056                throw new NoHistoryStorageEngineException();
 57            }
 22058            return HistoryStorageEngine.UpsertClassTimeSerie(HistoryStorageId!, projectName, className, historizationPro
 21959        }
 60
 61        /// <summary>
 62        /// Historize instance values in storage engine
 63        /// </summary>
 64        /// <param name="classTimeSerieId">The time series ID.</param>
 65        /// <param name="instance">The instance.</param>
 66        /// <param name="timestamp">the timestamp of the values</param>
 67        /// <param name="fieldsToHistorize">List of fields to be historized.</param>
 68        public void HistorizeValues(string classTimeSerieId, IInstance instance, DateTime timestamp, QualityLevel? quali
 2669        {
 2670            HistoryStorageEngine?.HistorizeValues(HistoryStorageId!, classTimeSerieId, instance.Name, timestamp, quality
 2671        }
 72    }
 73}