internal ProjectCollection(Microsoft.TeamFoundation.WorkItemTracking.Client.ProjectCollection valueProjects) : base( valueProjects.Cast <Microsoft.TeamFoundation.WorkItemTracking.Client.Project>() .Select(item => ExceptionHandlingDynamicProxyFactory.Create <IProject>(new Project(item))).ToList() ) { }
public IEnumerator <IField> GetEnumerator() { return(_innerCollection.Cast <Tfs.Field>() .Select( field => ExceptionHandlingDynamicProxyFactory.Create <IField>(new Field(field))) .GetEnumerator()); }
internal Field(Tfs.Field field) : base( ExceptionHandlingDynamicProxyFactory.Create <IRevisionInternal>(new WorkItem(field?.WorkItem)), ExceptionHandlingDynamicProxyFactory.Create <IFieldDefinition>(new FieldDefinition(field?.FieldDefinition))) { NativeField = field ?? throw new ArgumentNullException(nameof(field)); }
public IWorkItemStore Create(Uri endpoint, IEnumerable <TfsCredentials> credentials) { Func <WorkItemStore, IQueryFactory> queryFactoryFunc = QueryFactory.GetInstance; foreach (var credential in credentials) { try { var tfsNative = ConnectToTfsCollection(endpoint, credential.Credentials); System.Diagnostics.Trace.TraceInformation("TFS connection attempt success with {0}/{1}.", credential.Credentials.Windows.GetType(), credential.Credentials.Federated.GetType()); var tfs = ExceptionHandlingDynamicProxyFactory.Create <IInternalTfsTeamProjectCollection>(new TfsTeamProjectCollectionProxy(tfsNative)); var workItemStore = tfs.GetService <WorkItemStore>(); var queryFactory = queryFactoryFunc.Invoke(workItemStore); return(ExceptionHandlingDynamicProxyFactory.Create <IWorkItemStore>(new WorkItemStoreProxy(tfs, workItemStore, queryFactory))); } catch (TeamFoundationServerUnauthorizedException e) { System.Diagnostics.Trace.TraceWarning("TFS connection attempt failed with {0}/{1}.\n Exception: {2}", credential.Credentials.Windows.GetType(), credential.Credentials.Federated.GetType(), e); } } System.Diagnostics.Trace.TraceError("All TFS connection attempts failed."); throw new AccessDeniedException("Invalid credentials"); }
internal RelatedLink(Tfs.RelatedLink relatedLink) : base( relatedLink.RelatedWorkItemId, ExceptionHandlingDynamicProxyFactory.Create <IWorkItemLinkTypeEnd>(new WorkItemLinkTypeEnd(relatedLink.LinkTypeEnd)), relatedLink.Comment) { }
internal WorkItem(Tfs.WorkItem item) : base( ExceptionHandlingDynamicProxyFactory.Create <IWorkItemType>(new WorkItemType(item.Type)), () => ExceptionHandlingDynamicProxyFactory.Create <IFieldCollection>(new FieldCollection(item.Fields))) { _item = item; Url = item.Uri.ToString(); }
public override IEnumerator <IWorkItemType> GetEnumerator() { return(_workItemTypeCollection.Cast <Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemType>() .Select( item => ExceptionHandlingDynamicProxyFactory.Create <IWorkItemType>( new WorkItemType(item))) .GetEnumerator()); }
internal static IIdentityDescriptor AsProxy([NotNull] this Microsoft.TeamFoundation.Framework.Client.IdentityDescriptor descriptor) { if (descriptor == null) { throw new ArgumentNullException(nameof(descriptor)); } return(ExceptionHandlingDynamicProxyFactory.Create <IIdentityDescriptor>(new Client.Soap.IdentityDescriptor(descriptor))); }
internal FieldDefinitionCollection(Tfs.FieldDefinitionCollection innerCollection) : base( innerCollection.Cast <Tfs.FieldDefinition>() .Select( field => ExceptionHandlingDynamicProxyFactory.Create <IFieldDefinition>( new FieldDefinition(field))) .ToList()) { }
public IEnumerable <ITeamFoundationIdentity> ReadIdentities(ICollection <IIdentityDescriptor> descriptors) { var rawDescriptors = descriptors.Select(descriptor => new Tfs.Client.IdentityDescriptor(descriptor.IdentityType, descriptor.Identifier)).ToArray(); var identities = _identityManagementService2.ReadIdentities(rawDescriptors, Tfs.Common.MembershipQuery.None, Tfs.Common.ReadIdentityOptions.IncludeReadFromSource); return(identities.Select(identity => identity == null ? null : ExceptionHandlingDynamicProxyFactory.Create <ITeamFoundationIdentity>(new TeamFoundationIdentityProxy(identity)))); }
public override IWorkItemStore Create(AuthenticationOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } var tfsProxy = (IInternalTeamProjectCollection)TfsConnectionFactory.Default.Create(options); return(ExceptionHandlingDynamicProxyFactory.Create(CreateSoapWorkItemStore(tfsProxy))); }
public IQuery Create(string wiql, bool dayPrecision) { var q = new Query( new Microsoft.TeamFoundation.WorkItemTracking.Client.Query(_store.NativeWorkItemStore, wiql, null, dayPrecision), _store.Configuration.PageSize); return(_store.Configuration.ProxyCreationEnabled ? ExceptionHandlingDynamicProxyFactory.Create <IQuery>(q) : q); }
public override void Given() { ProxiedInstance = ExceptionHandlingDynamicProxyFactory.Create( InstanceToProxy, Enumerable.Empty <IExceptionExploder>(), new[] { new MockArgumentExceptionMapper() }); }
private ITeamFoundationIdentity TryCreateProxy(Tfs.Client.TeamFoundationIdentity identity) { if (identity == null) { return(null); } return (ExceptionHandlingDynamicProxyFactory.Create <ITeamFoundationIdentity>( new TeamFoundationIdentityProxy(identity))); }
internal WorkItemType(Tfs.WorkItemType type) : base( type?.Name, type?.Description, new Lazy <IFieldDefinitionCollection>(() => ExceptionHandlingDynamicProxyFactory.Create <IFieldDefinitionCollection>(new FieldDefinitionCollection(type?.FieldDefinitions))), () => ExceptionHandlingDynamicProxyFactory.Create <IWorkItem>(new WorkItem(type?.NewWorkItem())) ) { if (type == null) { throw new ArgumentNullException(nameof(type)); } }
internal TeamFoundationIdentity(Tfs.TeamFoundationIdentity identity) : base( identity.IsActive, identity.TeamFoundationId, identity.UniqueUserId, identity.MemberOf.Select(i => new IdentityDescriptor(i)).ToArray(), identity.Members.Select(i => new IdentityDescriptor(i)).ToArray()) { _identity = identity; _descriptor = new Lazy <IIdentityDescriptor>( () => ExceptionHandlingDynamicProxyFactory.Create <IIdentityDescriptor>( new IdentityDescriptor(_identity.Descriptor))); }
public ILink Map(Tfs.Link link) { if (link.BaseType == Tfs.BaseLinkType.RelatedLink) { var relatedLink = (Tfs.RelatedLink)link; return(ExceptionHandlingDynamicProxyFactory.Create <IRelatedLink>(new RelatedLinkProxy(relatedLink))); } if (link.BaseType == Tfs.BaseLinkType.Hyperlink) { var hyperlink = (Tfs.Hyperlink)link; return(ExceptionHandlingDynamicProxyFactory.Create <IHyperlink>(new HyperlinkProxy(hyperlink))); } throw new ArgumentException("Unknown link type", nameof(link)); }
public bool TryGetById(int id, out IField value) { try { var nativeField = _innerCollection.TryGetById(id); if (nativeField != null) { value = ExceptionHandlingDynamicProxyFactory.Create <IField>(new Field(nativeField)); return(true); } } catch (Exception) { } value = null; return(false); }
public IWorkItemCollection RunQuery() { var wic = _query.RunQuery(); wic.PageSize = _pageSize; // TODO: Use Lazy config options var items = new List <IWorkItem>(wic.Count); for (var i = 0; i < wic.Count; i++) { // TODO: Use proxy config options var item = ExceptionHandlingDynamicProxyFactory.Create <IWorkItem>((WorkItem)wic[i]); items.Add(item); } return(new WorkItemCollection(items)); }
/// <summary> /// Initializes a new instance of the <see cref="TfsTeamProjectCollection" /> class. /// </summary> /// <param name="teamProjectCollection">The TFS.</param> /// <exception cref="ArgumentNullException">tfs</exception> internal TfsTeamProjectCollection(Microsoft.TeamFoundation.Client.TfsTeamProjectCollection teamProjectCollection) { Native = teamProjectCollection ?? throw new ArgumentNullException(nameof(teamProjectCollection)); AuthorizedCredentials = Native.ClientCredentials; AuthorizedIdentity = new TeamFoundationIdentity(Native.AuthorizedIdentity); Uri = Native.Uri; _css = new Lazy <ICommonStructureService>( () => ExceptionHandlingDynamicProxyFactory.Create <ICommonStructureService>( new CommonStructureService( Native .GetService < ICommonStructureService4 >()))); }
public IQuery Create(IEnumerable <int> ids, string wiql) { if (ids == null) { throw new ArgumentNullException(nameof(ids)); } if (string.IsNullOrWhiteSpace(wiql)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(wiql)); } var q = new Query( new Microsoft.TeamFoundation.WorkItemTracking.Client.Query(_store.NativeWorkItemStore, wiql, ids.ToArray()), _store.Configuration.PageSize); return(_store.Configuration.ProxyCreationEnabled ? ExceptionHandlingDynamicProxyFactory.Create <IQuery>(q) : q); }
internal ILink Map(Tfs.Link link) { switch (link.BaseType) { case Tfs.BaseLinkType.RelatedLink: var relatedLink = (Tfs.RelatedLink)link; return(ExceptionHandlingDynamicProxyFactory.Create <IRelatedLink>(new RelatedLink(relatedLink))); case Tfs.BaseLinkType.Hyperlink: var hyperlink = (Tfs.Hyperlink)link; return(ExceptionHandlingDynamicProxyFactory.Create <IHyperlink>(new Hyperlink(hyperlink))); case Tfs.BaseLinkType.ExternalLink: var externalLink = (Tfs.ExternalLink)link; return(ExceptionHandlingDynamicProxyFactory.Create <IExternalLink>(new ExternalLink(externalLink))); default: throw new ArgumentException("Unknown link type", nameof(link)); } }
public IIdentityDescriptor CreateIdentityDescriptor(string identityType, string identifier) { return(ExceptionHandlingDynamicProxyFactory.Create <IIdentityDescriptor>(new IdentityDescriptorProxy(new Tfs.Client.IdentityDescriptor(identityType, identifier)))); }
internal static IIdentityManagementService AsProxy([CanBeNull] this IIdentityManagementService2 ims) { return(ims == null ? null : ExceptionHandlingDynamicProxyFactory.Create <IIdentityManagementService>(new IdentityManagementService(ims))); }
public override IWorkItemType this[string name] => ExceptionHandlingDynamicProxyFactory .Create <IWorkItemType>(new WorkItemType(_workItemTypeCollection[name]));
internal static ITeamFoundationIdentity AsProxy(this Microsoft.TeamFoundation.Framework.Client.TeamFoundationIdentity identity) { return(identity == null ? null : ExceptionHandlingDynamicProxyFactory.Create <ITeamFoundationIdentity>(new TeamFoundationIdentity(identity))); }
public IEnumerable <IWorkItemLinkInfo> RunLinkQuery() { return(_query.RunLinkQuery().Select(item => ExceptionHandlingDynamicProxyFactory.Create <IWorkItemLinkInfo>(new WorkItemLinkInfoProxy(item)))); }
public IEnumerable <IWorkItem> RunQuery() { return(_query.RunQuery().Cast <TeamFoundation.WorkItemTracking.Client.WorkItem>().Select(item => ExceptionHandlingDynamicProxyFactory.Create <IWorkItem>(new WorkItemProxy(item)))); }
public IWorkItem NewWorkItem() { return(ExceptionHandlingDynamicProxyFactory.Create <IWorkItem>(new WorkItemProxy(_type.NewWorkItem()))); }
public IField this[string name] { get { return(ExceptionHandlingDynamicProxyFactory.Create <IField>(new FieldProxy(_innerCollection[name]))); } }