public bool Add(TestTagType type, string value) { TestTag.RequireType(type); return(TryGetGroup(type, true, out var items) && ( items.Add(value ?? string.Empty) )); }
internal static TestTagType RequireType(TestTagType type) { if (type == TestTagType.Unspecified) { throw new ArgumentException(); } return(type); }
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)); }
public bool ContainsKey(TestTagType key) { return(_keys.ContainsKey(key)); }
public ICollection <string> this[TestTagType key] { get { return(_keys[key]); } }
public TestTag(TestTagType type, string value) { _type = RequireType(type); _value = string.IsNullOrEmpty(value) ? null : value; }
public TestTag(TestTagType name) : this(name, null) { }