public static string GetUserAlias(this ITeamFoundationIdentity identity) { if (identity == null) { throw new ArgumentNullException("identity"); } if (identity.Descriptor.Identifier.Contains("@")) { var identifier = identity.Descriptor.Identifier; var identifierSplit = identifier.Split('\\'); if (identifierSplit.Length == 2) { return(identifierSplit[1].Split('@')[0]); } } else { var uniqueName = identity.UniqueName; var uniqueNameSplit = uniqueName.Split('\\'); if (uniqueNameSplit.Length == 2) { return(uniqueNameSplit[1]); } } return(null); }
partial void RemoveProperty_PreCondition(ITeamFoundationIdentity instance, ref String name) { name = "TestingProperty"; var value = "TestingValue"; instance.SetProperty(name, value); }
/// <summary> /// Gets the user account name from the specified <see cref="ITeamFoundationIdentity" /> instance. /// </summary> /// <param name="identity">An instance of <see cref="ITeamFoundationIdentity" />.</param> /// <returns> /// The value of the <see cref="IdentityAttributeTags.AccountName" /> property; otherwise, /// <see cref="IdentityFieldValue.AccountName" />. /// </returns> public static string GetUserAccountName(this ITeamFoundationIdentity identity) { if (identity == null) { return(null); } return(identity.GetAttribute(IdentityAttributeTags.AccountName, null) ?? new IdentityFieldValue(identity).AccountName); }
/// <summary> /// Initializes a new instance of the <see cref="IdentityFieldValue" /> class. /// </summary> /// <param name="identity">The identity.</param> /// <exception cref="ArgumentNullException">identity</exception> public IdentityFieldValue([NotNull] ITeamFoundationIdentity identity) : this(identity.DisplayName, identity.Descriptor?.Identifier, identity.TeamFoundationId.ToString()) { Contract.Requires(identity != null); if (identity == null) { throw new ArgumentNullException(nameof(identity)); } }
public void GetAuthenticatedIdentity_UnitTest() { ITeamFoundationIdentity identity = default(ITeamFoundationIdentity); ExecuteMethod( () => { return((ITfsConnection)GetInstance()); }, instance => { identity = TeamFoundationIdentityImpl_UnitTests.GetInstance(); GetAuthenticatedIdentity_PreCondition(instance, ref identity); }, instance => { instance.GetAuthenticatedIdentity(out identity); }, instance => { GetAuthenticatedIdentity_PostValidate(instance, identity); }); }
partial void IsContainer_SetCondition(ref ITeamFoundationIdentity instance, ref Boolean setValue);
partial void UniqueName_SetCondition(ref ITeamFoundationIdentity instance, ref String setValue);
partial void TryGetProperty_PostValidate(ITeamFoundationIdentity instance, String name, Object value);
partial void SetAttribute_PreCondition(ITeamFoundationIdentity instance, ref String name, ref String value);
partial void RemoveProperty_PreCondition(ITeamFoundationIdentity instance, ref String name);
partial void SetProperty_PostValidate(ITeamFoundationIdentity instance, String name, Object value) { instance.RemoveProperty(IIdentityPropertyScope.Local, name); }
partial void SetProperty_PreCondition(ITeamFoundationIdentity instance, ref String name, ref Object value) { name = "TestingProperty"; value = "TestingValue"; }
partial void GetProperty_PreCondition(ITeamFoundationIdentity instance, ref String name) { name = "Account"; }
/// <summary> /// Gets the authenticated identity. /// </summary> /// <param name="identity">The identity.</param> /// <exception cref="ToBeImplementedException"></exception> void ITfsConnection.GetAuthenticatedIdentity(out ITeamFoundationIdentity identity) { throw new ToBeImplementedException(); }
/// <summary> /// Gets the user account (logon) name from the specified <see cref="ITeamFoundationIdentity" /> instance. /// </summary> /// <param name="identity">An instance of <see cref="ITeamFoundationIdentity" />.</param> /// <returns> /// <see cref="IdentityFieldValue.LogonName" /> /// </returns> public static string GetUserAlias(this ITeamFoundationIdentity identity) { return(identity == null ? null : new IdentityFieldValue(identity).LogonName); }
partial void Members_SetCondition(ref ITeamFoundationIdentity instance, ref IIdentityDescriptor[] setValue);
partial void RemoveProperty_PostValidate(ITeamFoundationIdentity instance, String name);
partial void AuthorizedIdentity_SetCondition(ref IIServerDataProvider instance, ref ITeamFoundationIdentity setValue);
partial void SetAttribute_PostValidate(ITeamFoundationIdentity instance, String name, String value);
partial void GetAuthenticatedIdentity_PostValidate(ITfsConnection instance, ITeamFoundationIdentity identity);
partial void TeamFoundationId_SetCondition(ref ITeamFoundationIdentity instance, ref Guid setValue);
partial void GetAuthenticatedIdentity_PreCondition(ITfsConnection instance, ref ITeamFoundationIdentity identity);
partial void TryGetProperty_PreCondition(ITeamFoundationIdentity instance, ref String name, ref Object value);
partial void GetProperties_PostValidate(ITeamFoundationIdentity instance);
partial void UniqueUserId_SetCondition(ref ITeamFoundationIdentity instance, ref Int32 setValue);
partial void GetProperties_PreCondition(ITeamFoundationIdentity instance);
public override void When() { ActualIdentity = IdentityService.GetIdentityForAlias(Alias, MockIdentityDescriptor.TenantId, MockIdentityDescriptor.Domain, "otherdomain"); }
public override void When() { _result = Instance.ReadIdentity(IdentitySearchFactor.AccountName, _input, MembershipQuery.Expanded); }