Пример #1
0
        protected override void Validate()
        {
            base.Validate();

            if (!Regex.IsMatch(this.Value, @"[\wäüöß-]+:[1-9]\d*\/\d+")) // e.g. "abcde:10/3
            {
                throw new ArgumentException($"The {nameof(AnswerId)} has an invalid format: \"{this.Value}\", Expected \"<configuration-name>:<questionLineNumber>/<answerLineNumber>\".");
            }

            var split = this.Value.Split('/');

            this.QuestionId = QuestionId.From(split[0]);
            this.LineNumber = int.Parse(split[1]);
        }
Пример #2
0
 public static AnswerId From(QuestionId questionId, int lineNumber)
 {
     return(AnswerId.From($"{questionId.Value}/{lineNumber}"));
 }