public MockTeamFoundationIdentity( IIdentityDescriptor descriptor, string displayName, Guid teamFoundationId, bool isActive = true, IEnumerable <IIdentityDescriptor> members = null, IEnumerable <IIdentityDescriptor> memberOf = null) : base( isActive, teamFoundationId == Guid.Empty ? Guid.NewGuid() : teamFoundationId, isActive ? 0 : 1, memberOf ?? ZeroLengthArrayOfIdentityDescriptor, members ?? ZeroLengthArrayOfIdentityDescriptor) { DisplayName = displayName ?? throw new ArgumentNullException(nameof(displayName)); IsContainer = false; Descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor)); var f = new IdentityFieldValue(DisplayName, Descriptor.Identifier, TeamFoundationId.ToString()); _properties = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase) { { IdentityAttributeTags.SchemaClassName, "User" }, { IdentityAttributeTags.Description, string.Empty }, { IdentityAttributeTags.Domain, f.Domain }, { IdentityAttributeTags.AccountName, f.AccountName }, { IdentityAttributeTags.DistinguishedName, string.Empty }, { IdentityAttributeTags.MailAddress, f.Email }, { IdentityAttributeTags.SpecialType, "Generic" }, { IdentityAttributeTags.IdentityTypeClaim, Descriptor.IdentityType } }; }
public override string ToString() { // Call of .ToString to avoid boxing Guid to Object // ReSharper disable RedundantToStringCallForValueType return($"Identity {TeamFoundationId.ToString()} (IdentityType: {(Descriptor == null ? string.Empty : Descriptor.IdentityType)}; Identifier: {(Descriptor == null ? string.Empty : Descriptor.Identifier)}; DisplayName: {DisplayName})"); // ReSharper restore RedundantToStringCallForValueType }