dependabot-nuget 0.321.1 → 0.321.3
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/DotNetPackageCorrelation/Model/PackageMapper.cs +9 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencyDiscoveryTargetingPacks.props +2 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencySolver/IDependencySolver.cs +8 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/DependencySolver/MSBuildDependencySolver.cs +32 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/ProjectDiscoveryResult.cs +1 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/SdkProjectDiscovery.cs +10 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/WorkspaceDiscoveryResult.cs +6 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +3 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/DotNetToolsJsonUpdater.cs +6 -3
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/FileWriterWorker.cs +326 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/IFileWriter.cs +14 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/FileWriters/XmlFileWriter.cs +465 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/GlobalJsonUpdater.cs +9 -5
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +26 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolver/MSBuildDependencySolverTests.cs +633 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Discover/SdkProjectDiscoveryTests.cs +49 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/EndToEndTests.cs +484 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/DotNetToolsJsonUpdaterTests.cs +181 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterTestsBase.cs +61 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests.cs +917 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/FileWriterWorkerTests_MiscellaneousTests.cs +109 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/TestFileWriterReturnsConstantResult.cs +20 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests.cs +1594 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/FileWriters/XmlFileWriterTests_CreateUpdatedVersionRangeTests.cs +25 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/GlobalJsonUpdaterTests.cs +139 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +1961 -1
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateOperationResultTests.cs +116 -0
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Utilities/MSBuildHelperTests.cs +0 -1043
- metadata +19 -10
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DotNetTools.cs +0 -375
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.GlobalJson.cs +0 -296
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.LockFile.cs +0 -251
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Mixed.cs +0 -201
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +0 -3821
- data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +0 -2706
@@ -0,0 +1,109 @@
|
|
1
|
+
using NuGetUpdater.Core.Discover;
|
2
|
+
using NuGetUpdater.Core.Test.Utilities;
|
3
|
+
using NuGetUpdater.Core.Updater.FileWriters;
|
4
|
+
|
5
|
+
using Xunit;
|
6
|
+
|
7
|
+
namespace NuGetUpdater.Core.Test.Update.FileWriters;
|
8
|
+
|
9
|
+
public class FileWriterWorkerTests_MiscellaneousTests
|
10
|
+
{
|
11
|
+
[Fact]
|
12
|
+
public void GetProjectDiscoveryEvaluationOrder()
|
13
|
+
{
|
14
|
+
// generate an ordered list of project discovery objects from the bottom of the graph to the top
|
15
|
+
|
16
|
+
// arrange
|
17
|
+
var repoContentsPath = new DirectoryInfo("/repo/root");
|
18
|
+
var startingProjectPath = "client/client.csproj";
|
19
|
+
var fullProjectPath = new FileInfo(Path.Join(repoContentsPath.FullName, startingProjectPath));
|
20
|
+
var discoveryResult = new WorkspaceDiscoveryResult()
|
21
|
+
{
|
22
|
+
Path = "client",
|
23
|
+
Projects = [
|
24
|
+
new ProjectDiscoveryResult()
|
25
|
+
{
|
26
|
+
FilePath = "client.csproj",
|
27
|
+
ReferencedProjectPaths = ["../common/common.csproj", "../utils/utils.csproj"],
|
28
|
+
Dependencies = [],
|
29
|
+
ImportedFiles = [],
|
30
|
+
AdditionalFiles = [],
|
31
|
+
},
|
32
|
+
new ProjectDiscoveryResult()
|
33
|
+
{
|
34
|
+
FilePath = "../common/common.csproj",
|
35
|
+
ReferencedProjectPaths = ["../utils/utils.csproj"],
|
36
|
+
Dependencies = [],
|
37
|
+
ImportedFiles = [],
|
38
|
+
AdditionalFiles = [],
|
39
|
+
},
|
40
|
+
new ProjectDiscoveryResult()
|
41
|
+
{
|
42
|
+
FilePath = "../utils/utils.csproj",
|
43
|
+
ReferencedProjectPaths = [],
|
44
|
+
Dependencies = [],
|
45
|
+
ImportedFiles = [],
|
46
|
+
AdditionalFiles = [],
|
47
|
+
},
|
48
|
+
// the server project is a red herring; it's not directly referenced by the client project and should not be in the final list
|
49
|
+
new ProjectDiscoveryResult()
|
50
|
+
{
|
51
|
+
FilePath = "../server/server.csproj",
|
52
|
+
ReferencedProjectPaths = ["../common/common.csproj", "../utils/utils.csproj"],
|
53
|
+
Dependencies = [],
|
54
|
+
ImportedFiles = [],
|
55
|
+
AdditionalFiles = [],
|
56
|
+
},
|
57
|
+
]
|
58
|
+
};
|
59
|
+
|
60
|
+
// act
|
61
|
+
var projectDiscoveryOrder = FileWriterWorker.GetProjectDiscoveryEvaluationOrder(repoContentsPath, discoveryResult, fullProjectPath, new TestLogger());
|
62
|
+
|
63
|
+
// assert
|
64
|
+
var actualProjectPaths = projectDiscoveryOrder
|
65
|
+
.Select(p => Path.Join(repoContentsPath.FullName, discoveryResult.Path, p.FilePath).FullyNormalizedRootedPath())
|
66
|
+
.Select(p => Path.GetRelativePath(repoContentsPath.FullName, p).NormalizePathToUnix())
|
67
|
+
.ToArray();
|
68
|
+
string[] expectedProjectPaths = [
|
69
|
+
"utils/utils.csproj",
|
70
|
+
"common/common.csproj",
|
71
|
+
"client/client.csproj",
|
72
|
+
];
|
73
|
+
AssertEx.Equal(expectedProjectPaths, actualProjectPaths);
|
74
|
+
}
|
75
|
+
|
76
|
+
[Fact]
|
77
|
+
public async Task AllProjectDiscoveryFilesCanBeReadAndRestored()
|
78
|
+
{
|
79
|
+
// arrange
|
80
|
+
var projectDiscoveryResults = new[]
|
81
|
+
{
|
82
|
+
new ProjectDiscoveryResult()
|
83
|
+
{
|
84
|
+
FilePath = "client.csproj",
|
85
|
+
ReferencedProjectPaths = ["../common/common.csproj", "../utils/utils.csproj"],
|
86
|
+
Dependencies = [],
|
87
|
+
ImportedFiles = [],
|
88
|
+
AdditionalFiles = ["packages.config"],
|
89
|
+
},
|
90
|
+
};
|
91
|
+
using var tempDir = await TemporaryDirectory.CreateWithContentsAsync(
|
92
|
+
("client/client.csproj", "initial client content"),
|
93
|
+
("client/packages.config", "initial packages config content")
|
94
|
+
);
|
95
|
+
var repoContentsPath = new DirectoryInfo(tempDir.DirectoryPath);
|
96
|
+
var startingProjectPath = "client/client.csproj";
|
97
|
+
var initialStartingDirectory = new DirectoryInfo(Path.GetDirectoryName(Path.Join(repoContentsPath.FullName, startingProjectPath))!);
|
98
|
+
|
99
|
+
// act - overwrite the files with new content then revert
|
100
|
+
var originalFileContents = await FileWriterWorker.GetOriginalFileContentsAsync(repoContentsPath, initialStartingDirectory, projectDiscoveryResults);
|
101
|
+
await File.WriteAllTextAsync(Path.Join(repoContentsPath.FullName, "client/client.csproj"), "new client content", TestContext.Current.CancellationToken);
|
102
|
+
await File.WriteAllTextAsync(Path.Join(repoContentsPath.FullName, "client/packages.config"), "new packages config content", TestContext.Current.CancellationToken);
|
103
|
+
await FileWriterWorker.RestoreOriginalFileContentsAsync(originalFileContents);
|
104
|
+
|
105
|
+
// assert
|
106
|
+
Assert.Equal("initial client content", await File.ReadAllTextAsync(Path.Join(repoContentsPath.FullName, "client/client.csproj"), TestContext.Current.CancellationToken));
|
107
|
+
Assert.Equal("initial packages config content", await File.ReadAllTextAsync(Path.Join(repoContentsPath.FullName, "client/packages.config"), TestContext.Current.CancellationToken));
|
108
|
+
}
|
109
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
using System.Collections.Immutable;
|
2
|
+
|
3
|
+
using NuGetUpdater.Core.Updater.FileWriters;
|
4
|
+
|
5
|
+
namespace NuGetUpdater.Core.Test.Update.FileWriters;
|
6
|
+
|
7
|
+
internal class TestFileWriterReturnsConstantResult : IFileWriter
|
8
|
+
{
|
9
|
+
public bool Result { get; }
|
10
|
+
|
11
|
+
public TestFileWriterReturnsConstantResult(bool result)
|
12
|
+
{
|
13
|
+
Result = result;
|
14
|
+
}
|
15
|
+
|
16
|
+
public Task<bool> UpdatePackageVersionsAsync(DirectoryInfo repoContentsPath, ImmutableArray<string> relativeFilePaths, ImmutableArray<Dependency> originalDependencies, ImmutableArray<Dependency> requiredPackageVersions, bool addPackageReferenceElementForPinnedPackages)
|
17
|
+
{
|
18
|
+
return Task.FromResult(Result);
|
19
|
+
}
|
20
|
+
}
|