public bool Add(TestTagType type, string value)
 {
     TestTag.RequireType(type);
     return(TryGetGroup(type, true, out var items) && (
                items.Add(value ?? string.Empty)
                ));
 }
Exemple #2
0
        internal static TestTagType RequireType(TestTagType type)
        {
            if (type == TestTagType.Unspecified)
            {
                throw new ArgumentException();
            }

            return(type);
        }
Exemple #3
0
 public bool TryGetValue(TestTagType key, out ICollection <string> value)
 {
     if (_keys.TryGetValue(key, out var result))
     {
         value = result;
         return(true);
     }
     value = null;
     return(false);
 }
 private bool TryGetGroup(TestTagType type, bool create, out HashSet <string> result)
 {
     if (create)
     {
         result = _tags.GetValueOrCache(
             type,
             _ => new HashSet <string>(StringComparer.OrdinalIgnoreCase)
             );
         return(true);
     }
     return(_tags.TryGetValue(type, out result));
 }
 public bool Contains(TestTagType type, string value)
 {
     TestTag.RequireType(type);
     return(TryGetGroup(type, false, out var items) &&
            (string.IsNullOrEmpty(value) || items.Contains(value)));
 }
 public bool Contains(TestTagType type)
 {
     TestTag.RequireType(type);
     return(TestTag.TryParse(type.ToString(), out var item) &&
            Contains(item));
 }
Exemple #7
0
 public bool ContainsKey(TestTagType key)
 {
     return(_keys.ContainsKey(key));
 }
Exemple #8
0
 public                                                        ICollection <string> this[TestTagType key] {
     get {
         return(_keys[key]);
     }
 }
Exemple #9
0
 public TestTag(TestTagType type, string value)
 {
     _type  = RequireType(type);
     _value = string.IsNullOrEmpty(value) ? null : value;
 }
Exemple #10
0
 public TestTag(TestTagType name) : this(name, null)
 {
 }