< Summary

Information
Class: ValidateLib.ErrorsAndWarnings.Errors.Error
Assembly: validatelib.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\ErrorsAndWarnings\Errors\Error.cs
Line coverage
90%
Covered lines: 9
Uncovered lines: 1
Coverable lines: 10
Total lines: 43
Line coverage: 90%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBlocks covered Blocks not covered
Error()60
Error()90
GetErrorType()10
GetMessageWithParams(...)50

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\ValidateLib\ErrorsAndWarnings\Errors\Error.cs

#LineLine coverage
 1using System.Globalization;
 2using System.Resources;
 3using ValidateLib.Metadata.ErrorHandling;
 4
 5namespace ValidateLib.ErrorsAndWarnings.Errors
 6{
 7    /// <summary>
 8    /// Class representing one validation error.
 9    /// </summary>
 10    public class Error : ErrorOrWarning
 11    {
 112        public string? AdditionalInfo { get; set; }
 113        protected ResourceManager ErrorManager = new ResourceManager(EWConstants.ErrorResources, typeof(Error).Assembly)
 114        public static ResourceManager ErrorManagerPublic = new ResourceManager(EWConstants.ErrorResources, typeof(Error)
 15        /// <summary>
 16        /// Prefix in the error message. Currently empty.
 17        /// </summary>
 118        protected string ErrorMessagePrefix { get; set; } = "";
 019        static ResourceManager _ResourceManager { get; set; } =
 120            new ResourceManager(EWConstants.PathToResources, typeof(Error).Assembly);
 21        /// <summary>
 22        /// Contains additional informations that can be shown in the error messages.
 23        /// </summary>
 124        public ErrorHandlingInfo? ErrorInfo { get; set; }
 25        public override ErrorType GetErrorType()
 26        {
 127            return ErrorType.ERROR;
 28        }
 29        /// <summary>
 30        /// Returns localized error message with parameters formated in the string.
 31        /// </summary>
 32        /// <param name="className"> Name of the class that is index in the .resx file.</param>
 33        /// <param name="cultureInfo"> Culture in which we want to have localized the message.</param>
 34        /// <param name="stringArgs"> Arguments of the message. </param>
 35        /// <returns> Localized error message. </returns>
 36        protected string GetMessageWithParams(string className, CultureInfo cultureInfo, params object?[] stringArgs)
 37        {
 138            string message = ErrorMessagePrefix + ErrorManager.GetString(className, cultureInfo)!;
 139            return string.Format(message, stringArgs);
 40        }
 41
 42    }
 43}