Skip to content

Commit 5c566f1

Browse files
authored
Fix linting issues (#391)
1 parent 9334831 commit 5c566f1

File tree

51 files changed

+375
-392
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+375
-392
lines changed

src/Cake.AzureDevOps.Tests/BaseAzureDevOpsCollectionSettingsImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Cake.AzureDevOps
1+
namespace Cake.AzureDevOps.Tests
22
{
33
using System;
44
using Cake.AzureDevOps.Authentication;

src/Cake.AzureDevOps.Tests/BaseAzureDevOpsProjectSettingsImpl.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Cake.AzureDevOps
1+
namespace Cake.AzureDevOps.Tests
22
{
33
using System;
44
using Cake.AzureDevOps.Authentication;

src/Cake.AzureDevOps.Tests/Boards/WorkItemTracking/AzureDevOpsWorkItemSettingsTests.cs

Lines changed: 44 additions & 44 deletions
Large diffs are not rendered by default.

src/Cake.AzureDevOps.Tests/Fakes/FakeAllSetBuildClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public override BuildHttpClient CreateBuildClient(Uri collectionUrl, IAzureDevOp
3434
mock.Setup(arg => arg.GetBuildWorkItemsRefsAsync(It.IsAny<string>(), It.IsAny<int>(), It.IsAny<int?>(), null, default))
3535
.ReturnsAsync((string projectName, int buildId, int? top, object userState, CancellationToken token) => new List<ResourceRef>
3636
{
37-
new ResourceRef { Id = "42" },
37+
new () { Id = "42" },
3838
});
3939

4040
mock = this.Setup(mock);

src/Cake.AzureDevOps.Tests/Fakes/FakeAllSetGitClientFactory.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ protected override Mock<GitHttpClient> Setup(Mock<GitHttpClient> m)
105105
// Setup CommitDiffs object
106106
var gitChanges = new List<GitChange>
107107
{
108-
new GitChange
108+
new ()
109109
{
110110
ChangeId = 1,
111111
ChangeType = VersionControlChangeType.Edit,
112112
Item = new GitItem("/src/project/myclass.cs", "ID1", GitObjectType.Commit, "6b13ff8", 0),
113113
},
114114
null,
115-
new GitChange
115+
new ()
116116
{
117117
ChangeId = 2,
118118
ChangeType = VersionControlChangeType.Edit,
@@ -152,7 +152,7 @@ protected override Mock<GitHttpClient> Setup(Mock<GitHttpClient> m)
152152
// Setup GitPullRequestCommentThread collection
153153
var commentThreads = new List<GitPullRequestCommentThread>
154154
{
155-
new GitPullRequestCommentThread
155+
new ()
156156
{
157157
Id = 11,
158158
ThreadContext = new CommentThreadContext()
@@ -161,12 +161,12 @@ protected override Mock<GitHttpClient> Setup(Mock<GitHttpClient> m)
161161
},
162162
Comments = new List<Comment>
163163
{
164-
new Comment { Content = "Hello", IsDeleted = false, CommentType = CommentType.CodeChange, Id = 1 },
165-
new Comment { Content = "Goodbye", IsDeleted = true, CommentType = CommentType.Text, Id = 2 },
164+
new () { Content = "Hello", IsDeleted = false, CommentType = CommentType.CodeChange, Id = 1 },
165+
new () { Content = "Goodbye", IsDeleted = true, CommentType = CommentType.Text, Id = 2 },
166166
},
167167
Status = CommentThreadStatus.Active,
168168
},
169-
new GitPullRequestCommentThread
169+
new ()
170170
{
171171
Id = 22,
172172
ThreadContext = null,
@@ -203,8 +203,8 @@ protected override Mock<GitHttpClient> Setup(Mock<GitHttpClient> m)
203203
.ReturnsAsync((Guid repoId, int prId, bool? b, object o, CancellationToken c)
204204
=> new List<GitPullRequestIteration>
205205
{
206-
new GitPullRequestIteration { Id = 42, CreatedDate = DateTime.Today.AddDays(-3) },
207-
new GitPullRequestIteration { Id = 16, CreatedDate = DateTime.Today.AddDays(-1) },
206+
new () { Id = 42, CreatedDate = DateTime.Today.AddDays(-3) },
207+
new () { Id = 16, CreatedDate = DateTime.Today.AddDays(-1) },
208208
});
209209

210210
m.Setup(arg => arg.GetPullRequestIterationsAsync(
@@ -216,16 +216,16 @@ protected override Mock<GitHttpClient> Setup(Mock<GitHttpClient> m)
216216
.ReturnsAsync((Guid repoId, int prId, bool? b, object o, CancellationToken c)
217217
=> new List<GitPullRequestIteration>
218218
{
219-
new GitPullRequestIteration { Id = null },
219+
new () { Id = null },
220220
});
221221

222222
// Setup GitPullRequestIterationChanges collection
223223
var changes = new GitPullRequestIterationChanges
224224
{
225225
ChangeEntries = new List<GitPullRequestChange>
226226
{
227-
new GitPullRequestChange { ChangeId = 100, ChangeTrackingId = 1, Item = new GitItem { Path = "/src/my/class1.cs" } },
228-
new GitPullRequestChange { ChangeId = 200, ChangeTrackingId = 2, Item = new GitItem { Path = string.Empty } },
227+
new () { ChangeId = 100, ChangeTrackingId = 1, Item = new GitItem { Path = "/src/my/class1.cs" } },
228+
new () { ChangeId = 200, ChangeTrackingId = 2, Item = new GitItem { Path = string.Empty } },
229229
},
230230
};
231231

@@ -273,7 +273,7 @@ protected override Mock<GitHttpClient> Setup(Mock<GitHttpClient> m)
273273
CancellationToken.None))
274274
.ReturnsAsync(() => new List<GitRef>()
275275
{
276-
new GitRef("master"),
276+
new ("master"),
277277
});
278278

279279
m.Setup(

src/Cake.AzureDevOps.Tests/Fakes/FakeAllSetTestManagementClientFactory.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ public override TestManagementHttpClient CreateTestManagementClient(Uri collecti
2222
{
2323
ResultsForGroup = new List<TestResultsDetailsForGroup>()
2424
{
25-
new TestResultsDetailsForGroup
25+
new ()
2626
{
2727
Results = new List<TestCaseResult>()
2828
{
29-
new TestCaseResult { Id = 11, TestRun = new ShallowReference { Id = "1" } },
30-
new TestCaseResult { Id = 12, TestRun = new ShallowReference { Id = "1" } },
31-
new TestCaseResult { Id = 13, TestRun = new ShallowReference { Id = "1" } },
29+
new () { Id = 11, TestRun = new ShallowReference { Id = "1" } },
30+
new () { Id = 12, TestRun = new ShallowReference { Id = "1" } },
31+
new () { Id = 13, TestRun = new ShallowReference { Id = "1" } },
3232
},
3333
},
3434
},
@@ -37,9 +37,9 @@ public override TestManagementHttpClient CreateTestManagementClient(Uri collecti
3737
mock.Setup(arg => arg.GetTestResultsAsync(It.IsAny<Guid>(), It.IsAny<int>(), null, It.IsAny<int?>(), It.IsAny<int?>(), It.IsAny<IEnumerable<TestOutcome>>(), null, default))
3838
.ReturnsAsync((Guid projectId, int testRunId, ResultDetails? details, int? skip, int? top, IEnumerable<TestOutcome> outcomes, object userState, CancellationToken token) => new List<TestCaseResult>()
3939
{
40-
new TestCaseResult { AutomatedTestName = "t1", Outcome = "Passed", ErrorMessage = string.Empty },
41-
new TestCaseResult { AutomatedTestName = "t2", Outcome = "Failed", ErrorMessage = "Error" },
42-
new TestCaseResult { AutomatedTestName = "t3", Outcome = "Passed", ErrorMessage = string.Empty },
40+
new () { AutomatedTestName = "t1", Outcome = "Passed", ErrorMessage = string.Empty },
41+
new () { AutomatedTestName = "t2", Outcome = "Failed", ErrorMessage = "Error" },
42+
new () { AutomatedTestName = "t3", Outcome = "Passed", ErrorMessage = string.Empty },
4343
}.Take(top.Value).ToList());
4444

4545
mock = this.Setup(mock);

src/Cake.AzureDevOps.Tests/Fakes/FakeAllSetWorkItemTrackingClientFactory.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
{
33
using System;
44
using System.Collections.Generic;
5+
using System.Linq;
56
using System.Threading;
67
using Cake.AzureDevOps.Authentication;
7-
using Microsoft.TeamFoundation.TestManagement.WebApi;
88
using Microsoft.TeamFoundation.WorkItemTracking.WebApi;
99
using Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models;
1010
using Moq;
@@ -18,14 +18,7 @@ public override WorkItemTrackingHttpClient CreateWorkItemTrackingClient(Uri coll
1818
mock.Setup(arg => arg.GetWorkItemsAsync(It.IsAny<IEnumerable<int>>(), It.IsAny<IEnumerable<string>>(), It.IsAny<DateTime?>(), It.IsAny<WorkItemExpand?>(), It.IsAny<WorkItemErrorPolicy?>(), null, default))
1919
.ReturnsAsync((IEnumerable<int> workItemIds, IEnumerable<string> fields, DateTime? asOf, WorkItemExpand? expand, WorkItemErrorPolicy? errorPolicy, object userState, CancellationToken token) =>
2020
{
21-
var result = new List<WorkItem>();
22-
23-
foreach (var workItemId in workItemIds)
24-
{
25-
result.Add(new WorkItem { Id = workItemId });
26-
}
27-
28-
return result;
21+
return workItemIds.Select(x => new WorkItem { Id = x }).ToList();
2922
});
3023

3124
mock = this.Setup(mock);

src/Cake.AzureDevOps.Tests/Fakes/FakeBuildClientFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public BuildHttpClient CreateBuildClient(Uri collectionUrl, IAzureDevOpsCredenti
1616
return this.CreateBuildClient(collectionUrl, credentials);
1717
}
1818

19-
protected virtual Mock<BuildHttpClient> Setup(Mock<BuildHttpClient> m)
19+
protected Mock<BuildHttpClient> Setup(Mock<BuildHttpClient> m)
2020
{
2121
return m;
2222
}

src/Cake.AzureDevOps.Tests/Fakes/FakeGitClientFactory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ public abstract class FakeGitClientFactory : IGitClientFactory
1010
{
1111
public abstract GitHttpClient CreateGitClient(Uri collectionUrl, IAzureDevOpsCredentials credentials);
1212

13-
public GitHttpClient CreateGitClient(Uri collectionUrl, IAzureDevOpsCredentials credentials, out Identity identity)
13+
public GitHttpClient CreateGitClient(Uri collectionUrl, IAzureDevOpsCredentials credentials, out Identity authorizedIdentity)
1414
{
15-
identity = new Identity { ProviderDisplayName = "FakeUser", Id = Guid.NewGuid(), IsActive = true };
15+
authorizedIdentity = new Identity { ProviderDisplayName = "FakeUser", Id = Guid.NewGuid(), IsActive = true };
1616
return this.CreateGitClient(collectionUrl, credentials);
1717
}
1818

src/Cake.AzureDevOps.Tests/Fakes/FakeNullBuildClientFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace Cake.AzureDevOps.Tests.Fakes
22
{
33
using System;
4-
using System.Threading;
54
using Cake.AzureDevOps.Authentication;
65
using Microsoft.TeamFoundation.Build.WebApi;
76
using Moq;

0 commit comments

Comments
 (0)