public static ApplicationProfile CreateApplicationProfileWithSingleAttribute <T>(YotiAttribute <T> attribute) { var attributes = new Dictionary <string, List <BaseAttribute> > { { attribute.GetName(), new List <BaseAttribute> { attribute } } }; return(new ApplicationProfile(attributes)); }
internal void Add <T>(YotiAttribute <T> newValue) { TryAddAttribute(newValue); string attributeName = newValue.GetName(); if (_attributes.ContainsKey(attributeName)) { List <BaseAttribute> attributeList = _attributes[attributeName]; attributeList.Add(newValue); _attributes[attributeName] = attributeList; } else { _attributes.Add(attributeName, new List <BaseAttribute> { newValue }); } }
public AgeVerification(YotiAttribute <string> derivedAttribute) { if (derivedAttribute == null) { throw new ArgumentNullException(nameof(derivedAttribute)); } string attributeName = derivedAttribute.GetName(); if (!Regex.IsMatch(attributeName, expectedFormatRegex)) { throw new InvalidOperationException( $"{nameof(attributeName)} {Properties.Resources.FormatMismatch} '{expectedFormatRegex}'"); } _derivedAttribute = derivedAttribute; string[] split = attributeName.Split(':'); _checkPerformed = split[0]; _ageVerified = int.Parse(split[1], new CultureInfo("en-GB")); _result = bool.Parse(derivedAttribute.GetValue()); }