dependabot-nuget 0.309.0 → 0.311.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/helpers/lib/NuGetUpdater/Directory.Packages.props +1 -1
- data/helpers/lib/NuGetUpdater/DotNetPackageCorrelation.Test/DotNetPackageCorrelation.Test.csproj +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Run.cs +6 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/NuGetUpdater.Cli.Test.csproj +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/ClosePullRequest.cs +13 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/CreatePullRequest.cs +20 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/Job.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/JobErrorBase.cs +19 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/MessageBase.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/ApiModel/UpdatePullRequest.cs +16 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/HttpApiHandler.cs +12 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/PullRequestTextGenerator.cs +49 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +31 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdateOperationBase.cs +1 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/DependencyConflictResolver.cs +6 -33
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +12 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Analyze/AnalyzeWorkerTests.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/DiscoveryWorkerTests.cs +2 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/MockNuGetPackage.cs +37 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/NuGetUpdater.Core.Test.csproj +1 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +355 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/MessageReportTests.cs +232 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/PullRequestTextTests.cs +32 -8
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +1212 -840
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +4 -2
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestHttpServer.cs +16 -6
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateOperationBaseTests.cs +3 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +1 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/EOLHandlingTests.cs +227 -13
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/LoggerTests.cs +0 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +382 -165
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/PathHelperTests.cs +1 -1
- data/helpers/lib/NuGetUpdater/global.json +1 -1
- metadata +11 -9
@@ -50,7 +50,8 @@ public class SerializationTests
|
|
50
50
|
"credentials-metadata": [
|
51
51
|
{
|
52
52
|
"host": "github.com",
|
53
|
-
"type": "git_source"
|
53
|
+
"type": "git_source",
|
54
|
+
"replaces-base": false
|
54
55
|
}
|
55
56
|
],
|
56
57
|
"max-updater-run-time": 0
|
@@ -116,7 +117,8 @@ public class SerializationTests
|
|
116
117
|
"credentials": [
|
117
118
|
{
|
118
119
|
"name": "some-cred",
|
119
|
-
"token": "abc123"
|
120
|
+
"token": "abc123",
|
121
|
+
"replaces-base": false
|
120
122
|
}
|
121
123
|
],
|
122
124
|
"existing-pull-requests": [
|
@@ -10,13 +10,13 @@ namespace NuGetUpdater.Core.Test
|
|
10
10
|
{
|
11
11
|
public class TestHttpServer : IDisposable
|
12
12
|
{
|
13
|
-
private readonly Func<string, (int, byte[])> _requestHandler;
|
13
|
+
private readonly Func<string, string, (int, byte[])> _requestHandler;
|
14
14
|
private readonly HttpListener _listener;
|
15
15
|
private bool _runServer = true;
|
16
16
|
|
17
17
|
public string BaseUrl { get; }
|
18
18
|
|
19
|
-
private TestHttpServer(string baseurl, Func<string, (int, byte[])> requestHandler)
|
19
|
+
private TestHttpServer(string baseurl, Func<string, string, (int, byte[])> requestHandler)
|
20
20
|
{
|
21
21
|
BaseUrl = baseurl;
|
22
22
|
_requestHandler = requestHandler;
|
@@ -43,7 +43,7 @@ namespace NuGetUpdater.Core.Test
|
|
43
43
|
while (_runServer)
|
44
44
|
{
|
45
45
|
var context = await _listener.GetContextAsync();
|
46
|
-
var (statusCode, response) = _requestHandler(context.Request.Url!.AbsoluteUri);
|
46
|
+
var (statusCode, response) = _requestHandler(context.Request.HttpMethod, context.Request.Url!.AbsoluteUri);
|
47
47
|
context.Response.StatusCode = statusCode;
|
48
48
|
await context.Response.OutputStream.WriteAsync(response);
|
49
49
|
context.Response.Close();
|
@@ -53,6 +53,11 @@ namespace NuGetUpdater.Core.Test
|
|
53
53
|
private static readonly object PortGate = new();
|
54
54
|
|
55
55
|
public static TestHttpServer CreateTestServer(Func<string, (int, byte[])> requestHandler)
|
56
|
+
{
|
57
|
+
return CreateTestServer((method, url) => requestHandler(url));
|
58
|
+
}
|
59
|
+
|
60
|
+
public static TestHttpServer CreateTestServer(Func<string, string, (int, byte[])> requestHandler)
|
56
61
|
{
|
57
62
|
// static lock to ensure the port is not recycled after `FindFreePort()` and before we can start the real server
|
58
63
|
lock (PortGate)
|
@@ -67,9 +72,14 @@ namespace NuGetUpdater.Core.Test
|
|
67
72
|
|
68
73
|
public static TestHttpServer CreateTestStringServer(Func<string, (int, string)> requestHandler)
|
69
74
|
{
|
70
|
-
|
75
|
+
return CreateTestStringServer((method, url) => requestHandler(url));
|
76
|
+
}
|
77
|
+
|
78
|
+
public static TestHttpServer CreateTestStringServer(Func<string, string, (int, string)> requestHandler)
|
79
|
+
{
|
80
|
+
Func<string, string, (int, byte[])> bytesRequestHandler = (method, url) =>
|
71
81
|
{
|
72
|
-
var (statusCode, response) = requestHandler(url);
|
82
|
+
var (statusCode, response) = requestHandler(method, url);
|
73
83
|
return (statusCode, Encoding.UTF8.GetBytes(response));
|
74
84
|
};
|
75
85
|
return CreateTestServer(bytesRequestHandler);
|
@@ -170,7 +180,7 @@ namespace NuGetUpdater.Core.Test
|
|
170
180
|
return (404, Encoding.UTF8.GetBytes("{}"));
|
171
181
|
}
|
172
182
|
|
173
|
-
var server =
|
183
|
+
var server = CreateTestServer((method, url) => HttpHandler(url));
|
174
184
|
return server;
|
175
185
|
}
|
176
186
|
|
@@ -43,9 +43,9 @@ public class UpdateOperationBaseTests
|
|
43
43
|
// assert
|
44
44
|
var expectedReport = """
|
45
45
|
Performed the following updates:
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
- Updated Package.A to 1.0.0 in file/a.txt
|
47
|
+
- Pinned Package.B at 2.0.0 in file/b.txt
|
48
|
+
- Updated Package.C to 3.0.0 indirectly via Package.D/4.0.0 in file/c.txt
|
49
49
|
""".Replace("\r", "");
|
50
50
|
Assert.Equal(expectedReport, actualReport);
|
51
51
|
}
|
data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs
CHANGED
@@ -382,19 +382,7 @@ public partial class UpdateWorkerTests
|
|
382
382
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "9.0.1", "net8.0"),
|
383
383
|
MockNuGetPackage.CreateSimplePackage("Some.Package", "13.0.1", "net8.0"),
|
384
384
|
// necessary for the `net8.0-windows10.0.19041.0` TFM
|
385
|
-
|
386
|
-
[
|
387
|
-
("data/FrameworkList.xml", Encoding.UTF8.GetBytes("""
|
388
|
-
<FileList Name="Windows SDK .NET 6.0">
|
389
|
-
<!-- contents omitted -->
|
390
|
-
</FileList>
|
391
|
-
""")),
|
392
|
-
("data/RuntimeList.xml", Encoding.UTF8.GetBytes("""
|
393
|
-
<FileList Name="Windows SDK .NET 6.0" TargetFrameworkIdentifier=".NETCoreApp" TargetFrameworkVersion="6.0" FrameworkName="Microsoft.Windows.SDK.NET.Ref">
|
394
|
-
<!-- contents omitted -->
|
395
|
-
</FileList>
|
396
|
-
""")),
|
397
|
-
]),
|
385
|
+
MockNuGetPackage.WellKnownWindowsSdkRefPackage("10.0.19041.0"),
|
398
386
|
],
|
399
387
|
// initial
|
400
388
|
projectContents: $"""
|
@@ -4,20 +4,234 @@ using Xunit;
|
|
4
4
|
|
5
5
|
using static NuGetUpdater.Core.Utilities.EOLHandling;
|
6
6
|
|
7
|
-
namespace NuGetUpdater.Core.Test.Utilities
|
7
|
+
namespace NuGetUpdater.Core.Test.Utilities;
|
8
|
+
|
9
|
+
public class EOLHandlingTests
|
8
10
|
{
|
9
|
-
|
11
|
+
[Theory]
|
12
|
+
[InlineData(EOLType.LF, "\n")]
|
13
|
+
[InlineData(EOLType.CR, "\r")]
|
14
|
+
[InlineData(EOLType.CRLF, "\r\n")]
|
15
|
+
public void ValidateEOLNormalizesFromLF(EOLType eolType, string literal)
|
16
|
+
{
|
17
|
+
var teststring = "this\ris\na\r\nstring\rwith\nmixed\r\nline\rendings\n.";
|
18
|
+
var changed = teststring.SetEOL(eolType);
|
19
|
+
var lineEndings = Regex.Split(changed, "\\S+");
|
20
|
+
Assert.All(lineEndings, lineEnding => lineEnding.Equals(literal));
|
21
|
+
}
|
22
|
+
|
23
|
+
[Theory]
|
24
|
+
[MemberData(nameof(GetPredominantEOLTestData))]
|
25
|
+
public void GetPredominantEOL(string fileContent, EOLType expectedEOL)
|
26
|
+
{
|
27
|
+
var actualEOL = fileContent.GetPredominantEOL();
|
28
|
+
Assert.Equal(expectedEOL, actualEOL);
|
29
|
+
}
|
30
|
+
|
31
|
+
[Theory]
|
32
|
+
[MemberData(nameof(SetEOLTestData))]
|
33
|
+
public void SetEOL(string currentFileContent, EOLType desiredEOL, string expectedFileContent)
|
34
|
+
{
|
35
|
+
var actualFileContent = currentFileContent.SetEOL(desiredEOL);
|
36
|
+
Assert.Equal(expectedFileContent, actualFileContent);
|
37
|
+
}
|
38
|
+
|
39
|
+
public static IEnumerable<object[]> GetPredominantEOLTestData()
|
10
40
|
{
|
11
|
-
|
12
|
-
|
13
|
-
[
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
41
|
+
// purely CR
|
42
|
+
yield return
|
43
|
+
[
|
44
|
+
// fileContent
|
45
|
+
string.Concat(
|
46
|
+
"line1\r",
|
47
|
+
"line2\r",
|
48
|
+
"line3\r"
|
49
|
+
),
|
50
|
+
// expectedEOL
|
51
|
+
EOLType.CR
|
52
|
+
];
|
53
|
+
|
54
|
+
// purely LF
|
55
|
+
yield return
|
56
|
+
[
|
57
|
+
// fileContent
|
58
|
+
string.Concat(
|
59
|
+
"line1\n",
|
60
|
+
"line2\n",
|
61
|
+
"line3\n"
|
62
|
+
),
|
63
|
+
// expectedEOL
|
64
|
+
EOLType.LF
|
65
|
+
];
|
66
|
+
|
67
|
+
// purely CRLF
|
68
|
+
yield return
|
69
|
+
[
|
70
|
+
// fileContent
|
71
|
+
string.Concat(
|
72
|
+
"line1\r\n",
|
73
|
+
"line2\r\n",
|
74
|
+
"line3\r\n"
|
75
|
+
),
|
76
|
+
// expectedEOL
|
77
|
+
EOLType.CRLF
|
78
|
+
];
|
79
|
+
|
80
|
+
// mostly CR
|
81
|
+
yield return
|
82
|
+
[
|
83
|
+
// fileContent
|
84
|
+
string.Concat(
|
85
|
+
"line1\r",
|
86
|
+
"line2\n",
|
87
|
+
"line3\r"
|
88
|
+
),
|
89
|
+
// expectedEOL
|
90
|
+
EOLType.CR
|
91
|
+
];
|
92
|
+
|
93
|
+
// mostly LF
|
94
|
+
yield return
|
95
|
+
[
|
96
|
+
// fileContent
|
97
|
+
string.Concat(
|
98
|
+
"line1\n",
|
99
|
+
"line2\r",
|
100
|
+
"line3\n"
|
101
|
+
),
|
102
|
+
// expectedEOL
|
103
|
+
EOLType.LF
|
104
|
+
];
|
105
|
+
|
106
|
+
// mostly CRLF
|
107
|
+
yield return
|
108
|
+
[
|
109
|
+
// fileContent
|
110
|
+
string.Concat(
|
111
|
+
"line1\r\n",
|
112
|
+
"line2\n",
|
113
|
+
"line3\r",
|
114
|
+
"line4\r\n"
|
115
|
+
),
|
116
|
+
// expectedEOL
|
117
|
+
EOLType.CRLF
|
118
|
+
];
|
119
|
+
}
|
120
|
+
|
121
|
+
public static IEnumerable<object[]> SetEOLTestData()
|
122
|
+
{
|
123
|
+
// CR to CR
|
124
|
+
yield return
|
125
|
+
[
|
126
|
+
// currentFileContent
|
127
|
+
string.Concat(
|
128
|
+
"line1\r",
|
129
|
+
"line2\r",
|
130
|
+
"line3\r"
|
131
|
+
),
|
132
|
+
// desiredEOL
|
133
|
+
EOLType.CR,
|
134
|
+
// expectedFileContent
|
135
|
+
string.Concat(
|
136
|
+
"line1\r",
|
137
|
+
"line2\r",
|
138
|
+
"line3\r"
|
139
|
+
)
|
140
|
+
];
|
141
|
+
|
142
|
+
// LF to LF
|
143
|
+
yield return
|
144
|
+
[
|
145
|
+
// currentFileContent
|
146
|
+
string.Concat(
|
147
|
+
"line1\n",
|
148
|
+
"line2\n",
|
149
|
+
"line3\n"
|
150
|
+
),
|
151
|
+
// desiredEOL
|
152
|
+
EOLType.LF,
|
153
|
+
// expectedFileContent
|
154
|
+
string.Concat(
|
155
|
+
"line1\n",
|
156
|
+
"line2\n",
|
157
|
+
"line3\n"
|
158
|
+
)
|
159
|
+
];
|
160
|
+
|
161
|
+
// CRLF to CRLF
|
162
|
+
yield return
|
163
|
+
[
|
164
|
+
// currentFileContent
|
165
|
+
string.Concat(
|
166
|
+
"line1\r\n",
|
167
|
+
"line2\r\n",
|
168
|
+
"line3\r\n"
|
169
|
+
),
|
170
|
+
// desiredEOL
|
171
|
+
EOLType.CRLF,
|
172
|
+
// expectedFileContent
|
173
|
+
string.Concat(
|
174
|
+
"line1\r\n",
|
175
|
+
"line2\r\n",
|
176
|
+
"line3\r\n"
|
177
|
+
)
|
178
|
+
];
|
179
|
+
|
180
|
+
// mixed to CR
|
181
|
+
yield return
|
182
|
+
[
|
183
|
+
// currentFileContent
|
184
|
+
string.Concat(
|
185
|
+
"line1\r",
|
186
|
+
"line2\n",
|
187
|
+
"line3\r\n"
|
188
|
+
),
|
189
|
+
// desiredEOL
|
190
|
+
EOLType.CR,
|
191
|
+
// expectedFileContent
|
192
|
+
string.Concat(
|
193
|
+
"line1\r",
|
194
|
+
"line2\r",
|
195
|
+
"line3\r"
|
196
|
+
)
|
197
|
+
];
|
198
|
+
|
199
|
+
// mixed to LF
|
200
|
+
yield return
|
201
|
+
[
|
202
|
+
// currentFileContent
|
203
|
+
string.Concat(
|
204
|
+
"line1\r",
|
205
|
+
"line2\n",
|
206
|
+
"line3\r\n"
|
207
|
+
),
|
208
|
+
// desiredEOL
|
209
|
+
EOLType.LF,
|
210
|
+
// expectedFileContent
|
211
|
+
string.Concat(
|
212
|
+
"line1\n",
|
213
|
+
"line2\n",
|
214
|
+
"line3\n"
|
215
|
+
)
|
216
|
+
];
|
217
|
+
|
218
|
+
// mixed to CRLF
|
219
|
+
yield return
|
220
|
+
[
|
221
|
+
// currentFileContent
|
222
|
+
string.Concat(
|
223
|
+
"line1\r",
|
224
|
+
"line2\n",
|
225
|
+
"line3\r\n"
|
226
|
+
),
|
227
|
+
// desiredEOL
|
228
|
+
EOLType.CRLF,
|
229
|
+
// expectedFileContent
|
230
|
+
string.Concat(
|
231
|
+
"line1\r\n",
|
232
|
+
"line2\r\n",
|
233
|
+
"line3\r\n"
|
234
|
+
)
|
235
|
+
];
|
22
236
|
}
|
23
237
|
}
|