public Tags Add(string tagName) { _tagValidator.Validate(tagName); var tag = new Tags { Name = tagName }; _tagRepository.Insert(tag); _tagRepository.Save(); return(tag); }
public TValue this[int index] { get { if (index < 0 || index >= _dict.Count) { throw new System.IndexOutOfRangeException(); } var key = _dict.Keys.Take(index + 1).Last(); return(_dict[key]); } set { if (index < 0 || index >= _dict.Count) { throw new System.IndexOutOfRangeException(); } var key = _dict.Keys.Take(index + 1).Last(); if (!_validator.Validate(key, value)) { throw new TaggedCollectionValidationException(); } this[key] = value; } }
public void Validate_ShouldSetTheRelatedTag() { var startTag = new TagInfo { TagName = "if" }; var endTag = new TagInfo { TagName = "if" }; _validator.Validate(new List <ITagInfo> { startTag }, new List <ITagInfo> { endTag }); Same(startTag.RelatedTag, endTag); Same(endTag.RelatedTag, startTag); }
public void ValidateTagName(string value) => _target.Validate(value);