-
Notifications
You must be signed in to change notification settings - Fork 12
(GH-356) Get work items from build #357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pascalberger
merged 6 commits into
cake-contrib:develop
from
twenzel:feature/GetWorkItemIds
Sep 30, 2022
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a0c91f9
Get work item ids
twenzel 6766d9d
fix formatting
twenzel 1903650
Return work items
twenzel 8f402f5
Update src/Cake.AzureDevOps/Pipelines/AzureDevOpsBuild.cs
pascalberger b0c0fd6
Update src/Cake.AzureDevOps/Pipelines/AzureDevOpsBuild.cs
pascalberger 171a888
Update src/Cake.AzureDevOps/AzureDevOpsAliases.Pipelines.cs
pascalberger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Cake.AzureDevOps.Tests/Fakes/FakeAllSetWorkItemTrackingClientFactory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
namespace Cake.AzureDevOps.Tests.Fakes | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using Cake.AzureDevOps.Authentication; | ||
using Microsoft.TeamFoundation.TestManagement.WebApi; | ||
using Microsoft.TeamFoundation.WorkItemTracking.WebApi; | ||
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models; | ||
using Moq; | ||
|
||
public class FakeAllSetWorkItemTrackingClientFactory : FakeWorkItemTrackingClientFactory | ||
{ | ||
public override WorkItemTrackingHttpClient CreateWorkItemTrackingClient(Uri collectionUrl, IAzureDevOpsCredentials credentials) | ||
{ | ||
var mock = new Mock<WorkItemTrackingHttpClient>(MockBehavior.Strict, collectionUrl, credentials.ToVssCredentials()); | ||
|
||
mock.Setup(arg => arg.GetWorkItemsAsync(It.IsAny<IEnumerable<int>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<DateTime?>(), It.IsAny<WorkItemExpand?>(), It.IsAny<WorkItemErrorPolicy?>(), null, default)) | ||
.ReturnsAsync((IEnumerable<int> workItemIds, IEnumerable<string> fields, DateTime? asOf, WorkItemExpand? expand, WorkItemErrorPolicy? errorPolicy, object userState, CancellationToken token) => | ||
{ | ||
var result = new List<WorkItem>(); | ||
|
||
foreach (var workItemId in workItemIds) | ||
{ | ||
result.Add(new WorkItem { Id = workItemId }); | ||
} | ||
|
||
return result; | ||
}); | ||
|
||
mock = this.Setup(mock); | ||
|
||
return mock.Object; | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/Cake.AzureDevOps.Tests/Fakes/FakeWorkItemTrackingClientFactory.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace Cake.AzureDevOps.Tests.Fakes | ||
{ | ||
using System; | ||
using Cake.AzureDevOps.Authentication; | ||
using Microsoft.TeamFoundation.WorkItemTracking.WebApi; | ||
using Microsoft.VisualStudio.Services.Identity; | ||
using Moq; | ||
|
||
public abstract class FakeWorkItemTrackingClientFactory : IWorkItemTrackingClientFactory | ||
{ | ||
public abstract WorkItemTrackingHttpClient CreateWorkItemTrackingClient(Uri collectionUrl, IAzureDevOpsCredentials credentials); | ||
|
||
public WorkItemTrackingHttpClient CreateWorkItemTrackingClient(Uri collectionUrl, IAzureDevOpsCredentials credentials, out Identity authorizedIdentity) | ||
{ | ||
authorizedIdentity = new Identity { ProviderDisplayName = "FakeUser", Id = Guid.NewGuid(), IsActive = true }; | ||
return this.CreateWorkItemTrackingClient(collectionUrl, credentials); | ||
} | ||
|
||
protected virtual Mock<WorkItemTrackingHttpClient> Setup(Mock<WorkItemTrackingHttpClient> m) | ||
{ | ||
return m; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.