예제 #1
0
        private static Rule MakeRule(ErrorNumber errorNumber, string fullDescription, string messageFormat)
        {
            string messageStringWithPath = string.Format(CultureInfo.CurrentCulture, RuleResources.ErrorMessageStringWithPath, messageFormat);

            return(new Rule
            {
                Id = ResultFactory.RuleIdFromErrorNumber(errorNumber),
                Configuration = new RuleConfiguration
                {
                    DefaultLevel = RuleConfigurationDefaultLevel.Error
                },
                Name = new Message
                {
                    Text = errorNumber.ToString()
                },
                FullDescription = new Message
                {
                    Text = fullDescription
                },
                MessageStrings = new Dictionary <string, string>
                {
                    [DefaultRuleMessageId] = messageStringWithPath
                }
            });
        }
예제 #2
0
        private static ReportingDescriptor MakeRule(ErrorNumber errorNumber, string fullDescription, string messageFormat)
        {
            string messageStringWithPath = string.Format(CultureInfo.CurrentCulture, RuleResources.ErrorMessageStringWithPath, messageFormat);

            return(new ReportingDescriptor
            {
                Id = ResultFactory.RuleIdFromErrorNumber(errorNumber),
                DefaultConfiguration = new ReportingConfiguration
                {
                    Level = FailureLevel.Error
                },
                Name = errorNumber.ToString(),
                FullDescription = new MultiformatMessageString
                {
                    Text = fullDescription
                },
                MessageStrings = new Dictionary <string, MultiformatMessageString>
                {
                    [DefaultRuleMessageId] = new MultiformatMessageString {
                        Text = messageStringWithPath
                    }
                }
            });
        }