public void Validate_Fail(string[] attributeTags, TagBehavior behavior, IList <string> tagsToMatch)
        {
            var attribute = new MigrationTypeTagsAttribute(behavior, attributeTags);

            var result = m_migrationTypeValidator.Validate(new List <TagsAttribute> {
                attribute
            }, tagsToMatch);

            Assert.False(result);
        }
Esempio n. 2
0
        private bool GetResultForTags(IList <TagsAttribute> tags, TagBehavior behavior, IList <string> matchTagsList)
        {
            var tagNames = tags.Where(t => t.Behavior == behavior).SelectMany(t => t.TagNames).ToArray();

            switch (behavior)
            {
            case TagBehavior.RequireAll:
                return(tagNames.Any() && matchTagsList.All(t => tagNames.Any(t.Equals)));

            case TagBehavior.RequireAny:
                return(tagNames.Any() && matchTagsList.Any(t => tagNames.Any(t.Equals)));;

            default:
                throw new ArgumentOutOfRangeException(nameof(behavior), behavior, null);
            }
        }
 protected TagsWithTypeAttribute(TagsType tagsType, TagBehavior behavior, params string[] tags) : base(behavior, tags)
 {
     TagsType = tagsType;
 }
 public MigTag(TagBehavior behavior, params string[] tagNames) : base(behavior, tagNames)
 {
 }
Esempio n. 5
0
 public TagsAttribute(TagBehavior behavior, params string[] tagNames)
 {
     Behavior = behavior;
     TagNames = tagNames;
 }
 public MigrationTypeTagsAttribute(TagBehavior behavior, params string[] migrationTypeTag) : base(TagsType.MigrationType, behavior, migrationTypeTag)
 {
 }