dependabot-nuget 0.284.0 → 0.286.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/helpers/lib/NuGetUpdater/NuGetProjects/Directory.Build.props +5 -1
  3. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.CommandLine/NuGet.CommandLine.csproj +1 -0
  4. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Configuration/NuGet.Configuration.csproj +1 -0
  5. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.LibraryModel/NuGet.LibraryModel.csproj +1 -0
  6. data/helpers/lib/NuGetUpdater/NuGetProjects/NuGet.Packaging/NuGet.Packaging.csproj +1 -1
  7. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/RunCommand.cs +8 -1
  8. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli/Commands/UpdateCommand.cs +7 -3
  9. data/helpers/lib/NuGetUpdater/NuGetUpdater.Cli.Test/EntryPointTests.Update.cs +11 -0
  10. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Analyze/AnalyzeWorker.cs +1 -1
  11. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Discover/DiscoveryWorker.cs +2 -2
  12. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/ExperimentsManager.cs +52 -0
  13. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/IAnalyzeWorker.cs +9 -0
  14. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/IDiscoveryWorker.cs +8 -0
  15. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/IUpdaterWorker.cs +9 -0
  16. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Run/RunWorker.cs +104 -33
  17. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackageReferenceUpdater.cs +6 -5
  18. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/PackagesConfigUpdater.cs +37 -5
  19. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Updater/UpdaterWorker.cs +5 -3
  20. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/MSBuildHelper.cs +0 -5
  21. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core/Utilities/PathHelper.cs +2 -0
  22. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/RunWorkerTests.cs +975 -57
  23. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/SerializationTests.cs +168 -0
  24. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Run/UpdatedDependencyListTests.cs +53 -6
  25. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestAnalyzeWorker.cs +37 -0
  26. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestDiscoveryWorker.cs +35 -0
  27. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/TestUpdaterWorker.cs +39 -0
  28. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/PackagesConfigUpdaterTests.cs +104 -3
  29. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs +51 -13
  30. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.DirsProj.cs +4 -2
  31. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackageReference.cs +22 -17
  32. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.PackagesConfig.cs +1 -1
  33. data/lib/dependabot/nuget/file_updater.rb +8 -3
  34. data/lib/dependabot/nuget/native_helpers.rb +11 -12
  35. metadata +12 -6
  36. data/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/DependencySolverEnvironment.cs +0 -12
@@ -59,6 +59,162 @@ public class SerializationTests
59
59
  Assert.Equal("specific-sdk", jobWrapper.Job.Source.Directory);
60
60
  }
61
61
 
62
+ [Fact]
63
+ public void DeserializeJob_FieldsNotYetSupported()
64
+ {
65
+ // the `source` field is required in the C# model; the remaining fields might exist in the JSON file, but are
66
+ // not yet supported in the C# model (some keys missing, others deserialize to `object?`; deserialization
67
+ // should not fail
68
+ var jobWrapper = RunWorker.Deserialize("""
69
+ {
70
+ "job": {
71
+ "source": {
72
+ "provider": "github",
73
+ "repo": "some-org/some-repo",
74
+ "directory": "specific-sdk",
75
+ "hostname": null,
76
+ "api-endpoint": null
77
+ },
78
+ "id": "some-id",
79
+ "allowed-updates": [
80
+ {
81
+ "dependency-type": "direct",
82
+ "update-type": "all"
83
+ }
84
+ ],
85
+ "credentials": [
86
+ {
87
+ "name": "some-cred",
88
+ "token": "abc123"
89
+ }
90
+ ],
91
+ "existing-pull-requests": [
92
+ [
93
+ {
94
+ "dependency-name": "Some.Package",
95
+ "dependency-version": "1.2.3"
96
+ }
97
+ ]
98
+ ],
99
+ "repo-contents-path": "/path/to/repo",
100
+ "token": "abc123"
101
+ }
102
+ }
103
+ """);
104
+ Assert.Equal("github", jobWrapper.Job.Source.Provider);
105
+ Assert.Equal("some-org/some-repo", jobWrapper.Job.Source.Repo);
106
+ Assert.Equal("specific-sdk", jobWrapper.Job.Source.Directory);
107
+ }
108
+
109
+ [Fact]
110
+ public void DeserializeExperimentsManager()
111
+ {
112
+ var jobWrapper = RunWorker.Deserialize("""
113
+ {
114
+ "job": {
115
+ "package-manager": "nuget",
116
+ "allowed-updates": [
117
+ {
118
+ "update-type": "all"
119
+ }
120
+ ],
121
+ "source": {
122
+ "provider": "github",
123
+ "repo": "some-org/some-repo",
124
+ "directory": "some-dir"
125
+ },
126
+ "experiments": {
127
+ "nuget_legacy_dependency_solver": true,
128
+ "unexpected_bool": true,
129
+ "unexpected_number": 42,
130
+ "unexpected_null": null,
131
+ "unexpected_string": "abc",
132
+ "unexpected_array": [1, "two", 3.0],
133
+ "unexpected_object": {
134
+ "a": 1,
135
+ "b": "two"
136
+ }
137
+ }
138
+ }
139
+ }
140
+ """);
141
+ var experimentsManager = ExperimentsManager.GetExperimentsManager(jobWrapper.Job.Experiments);
142
+ Assert.True(experimentsManager.UseLegacyDependencySolver);
143
+ }
144
+
145
+ [Fact]
146
+ public void DeserializeExperimentsManager_EmptyExperiments()
147
+ {
148
+ var jobWrapper = RunWorker.Deserialize("""
149
+ {
150
+ "job": {
151
+ "package-manager": "nuget",
152
+ "allowed-updates": [
153
+ {
154
+ "update-type": "all"
155
+ }
156
+ ],
157
+ "source": {
158
+ "provider": "github",
159
+ "repo": "some-org/some-repo",
160
+ "directory": "some-dir"
161
+ },
162
+ "experiments": {
163
+ }
164
+ }
165
+ }
166
+ """);
167
+ var experimentsManager = ExperimentsManager.GetExperimentsManager(jobWrapper.Job.Experiments);
168
+ Assert.False(experimentsManager.UseLegacyDependencySolver);
169
+ }
170
+
171
+ [Fact]
172
+ public void DeserializeExperimentsManager_NoExperiments()
173
+ {
174
+ var jobWrapper = RunWorker.Deserialize("""
175
+ {
176
+ "job": {
177
+ "package-manager": "nuget",
178
+ "allowed-updates": [
179
+ {
180
+ "update-type": "all"
181
+ }
182
+ ],
183
+ "source": {
184
+ "provider": "github",
185
+ "repo": "some-org/some-repo",
186
+ "directory": "some-dir"
187
+ }
188
+ }
189
+ }
190
+ """);
191
+ var experimentsManager = ExperimentsManager.GetExperimentsManager(jobWrapper.Job.Experiments);
192
+ Assert.False(experimentsManager.UseLegacyDependencySolver);
193
+ }
194
+
195
+ [Fact]
196
+ public async Task DeserializeExperimentsManager_UnsupportedJobFileShape_InfoIsReportedAndEmptyExperimentSetIsReturned()
197
+ {
198
+ // arrange
199
+ using var tempDir = new TemporaryDirectory();
200
+ var jobFilePath = Path.Combine(tempDir.DirectoryPath, "job.json");
201
+ var jobContent = """
202
+ {
203
+ "this-is-not-a-job-and-parsing-will-fail-but-an-empty-experiment-set-should-sill-be-returned": {
204
+ }
205
+ }
206
+ """;
207
+ await File.WriteAllTextAsync(jobFilePath, jobContent);
208
+ var capturingTestLogger = new CapturingTestLogger();
209
+
210
+ // act - this is the entrypoint the update command uses to parse the job file
211
+ var experimentsManager = await ExperimentsManager.FromJobFileAsync(jobFilePath, capturingTestLogger);
212
+
213
+ // assert
214
+ Assert.False(experimentsManager.UseLegacyDependencySolver);
215
+ Assert.Single(capturingTestLogger.Messages.Where(m => m.Contains("Error deserializing job file")));
216
+ }
217
+
62
218
  [Fact]
63
219
  public void SerializeError()
64
220
  {
@@ -67,4 +223,16 @@ public class SerializationTests
67
223
  var expected = """{"data":{"error-type":"job_repo_not_found","error-details":{"message":"some message"}}}""";
68
224
  Assert.Equal(expected, actual);
69
225
  }
226
+
227
+ private class CapturingTestLogger : ILogger
228
+ {
229
+ private readonly List<string> _messages = new();
230
+
231
+ public IReadOnlyList<string> Messages => _messages;
232
+
233
+ public void Log(string message)
234
+ {
235
+ _messages.Add(message);
236
+ }
237
+ }
70
238
  }
@@ -13,6 +13,18 @@ public class UpdatedDependencyListTests
13
13
  [Fact]
14
14
  public void GetUpdatedDependencyListFromDiscovery()
15
15
  {
16
+ using var temp = new TemporaryDirectory();
17
+ Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "a"));
18
+ Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "b"));
19
+ Directory.CreateDirectory(Path.Combine(temp.DirectoryPath, "src", "c"));
20
+
21
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "a", "packages.config"), "");
22
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "b", "packages.config"), "");
23
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "c", "packages.config"), "");
24
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "a", "project.csproj"), "");
25
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "b", "project.csproj"), "");
26
+ File.WriteAllText(Path.Combine(temp.DirectoryPath, "src", "c", "project.csproj"), "");
27
+
16
28
  var discovery = new WorkspaceDiscoveryResult()
17
29
  {
18
30
  Path = "src",
@@ -20,10 +32,31 @@ public class UpdatedDependencyListTests
20
32
  Projects = [
21
33
  new()
22
34
  {
23
- FilePath = "project.csproj",
35
+ FilePath = "a/project.csproj",
24
36
  Dependencies = [
25
37
  new("Microsoft.Extensions.DependencyModel", "6.0.0", DependencyType.PackageReference, TargetFrameworks: ["net6.0"]),
38
+ ],
39
+ IsSuccess = true,
40
+ Properties = [],
41
+ TargetFrameworks = ["net8.0"],
42
+ ReferencedProjectPaths = [],
43
+ },
44
+ new()
45
+ {
46
+ FilePath = "b/project.csproj",
47
+ Dependencies = [
48
+ ],
49
+ IsSuccess = true,
50
+ Properties = [],
51
+ TargetFrameworks = ["net8.0"],
52
+ ReferencedProjectPaths = [],
53
+ },
54
+ new()
55
+ {
56
+ FilePath = "c/project.csproj",
57
+ Dependencies = [
26
58
  new("System.Text.Json", "6.0.0", DependencyType.Unknown, TargetFrameworks: ["net6.0"], IsTransitive: true),
59
+ new("Newtonsoft.Json", "13.0.1", DependencyType.PackagesConfig, TargetFrameworks: ["net6.0"]),
27
60
  ],
28
61
  IsSuccess = true,
29
62
  Properties = [],
@@ -32,7 +65,7 @@ public class UpdatedDependencyListTests
32
65
  }
33
66
  ]
34
67
  };
35
- var updatedDependencyList = RunWorker.GetUpdatedDependencyListFromDiscovery(discovery);
68
+ var updatedDependencyList = RunWorker.GetUpdatedDependencyListFromDiscovery(discovery, pathToContents: temp.DirectoryPath);
36
69
  var expectedDependencyList = new UpdatedDependencyList()
37
70
  {
38
71
  Dependencies =
@@ -46,9 +79,9 @@ public class UpdatedDependencyListTests
46
79
  new ReportedRequirement()
47
80
  {
48
81
  Requirement = "6.0.0",
49
- File = "/src/project.csproj",
82
+ File = "/src/a/project.csproj",
50
83
  Groups = ["dependencies"],
51
- }
84
+ },
52
85
  ]
53
86
  },
54
87
  new ReportedDependency()
@@ -56,9 +89,23 @@ public class UpdatedDependencyListTests
56
89
  Name = "System.Text.Json",
57
90
  Version = "6.0.0",
58
91
  Requirements = [],
59
- }
92
+ },
93
+ new ReportedDependency()
94
+ {
95
+ Name = "Newtonsoft.Json",
96
+ Version = "13.0.1",
97
+ Requirements =
98
+ [
99
+ new ReportedRequirement()
100
+ {
101
+ Requirement = "13.0.1",
102
+ File = "/src/c/packages.config",
103
+ Groups = ["dependencies"],
104
+ },
105
+ ]
106
+ },
60
107
  ],
61
- DependencyFiles = ["/src/project.csproj"],
108
+ DependencyFiles = ["/src/a/project.csproj", "/src/b/project.csproj", "/src/c/project.csproj", "/src/a/packages.config", "/src/b/packages.config", "/src/c/packages.config"],
62
109
  };
63
110
 
64
111
  // doing JSON comparison makes this easier; we don't have to define custom record equality and we get an easy diff
@@ -0,0 +1,37 @@
1
+ using NuGetUpdater.Core.Analyze;
2
+ using NuGetUpdater.Core.Discover;
3
+
4
+ namespace NuGetUpdater.Core.Test;
5
+
6
+ internal class TestAnalyzeWorker : IAnalyzeWorker
7
+ {
8
+ private readonly Func<(string, WorkspaceDiscoveryResult, DependencyInfo), Task<AnalysisResult>> _getResult;
9
+
10
+ public TestAnalyzeWorker(Func<(string, WorkspaceDiscoveryResult, DependencyInfo), Task<AnalysisResult>> getResult)
11
+ {
12
+ _getResult = getResult;
13
+ }
14
+
15
+ public Task<AnalysisResult> RunAsync(string repoRoot, WorkspaceDiscoveryResult discovery, DependencyInfo dependencyInfo)
16
+ {
17
+ return _getResult((repoRoot, discovery, dependencyInfo));
18
+ }
19
+
20
+ public static TestAnalyzeWorker FromResults(params (string RepoRoot, WorkspaceDiscoveryResult Discovery, DependencyInfo DependencyInfo, AnalysisResult Result)[] results)
21
+ {
22
+ return new TestAnalyzeWorker(((string RepoRoot, WorkspaceDiscoveryResult Discovery, DependencyInfo DependencyInfo) input) =>
23
+ {
24
+ foreach (var set in results)
25
+ {
26
+ if (set.RepoRoot == input.RepoRoot &&
27
+ set.Discovery == input.Discovery &&
28
+ set.DependencyInfo == input.DependencyInfo)
29
+ {
30
+ return Task.FromResult(set.Result);
31
+ }
32
+ }
33
+
34
+ throw new NotImplementedException($"No saved response for {input}");
35
+ });
36
+ }
37
+ }
@@ -0,0 +1,35 @@
1
+ using NuGetUpdater.Core.Discover;
2
+
3
+ namespace NuGetUpdater.Core.Test;
4
+
5
+ internal class TestDiscoveryWorker : IDiscoveryWorker
6
+ {
7
+ private readonly Func<(string, string), Task<WorkspaceDiscoveryResult>> _getResult;
8
+
9
+ public TestDiscoveryWorker(Func<(string, string), Task<WorkspaceDiscoveryResult>> getResult)
10
+ {
11
+ _getResult = getResult;
12
+ }
13
+
14
+ public Task<WorkspaceDiscoveryResult> RunAsync(string repoRootPath, string workspacePath)
15
+ {
16
+ return _getResult((repoRootPath, workspacePath));
17
+ }
18
+
19
+ public static TestDiscoveryWorker FromResults(params (string RepoRootPath, string WorkspacePath, WorkspaceDiscoveryResult Result)[] results)
20
+ {
21
+ return new TestDiscoveryWorker(((string RepoRootPath, string WorkspacePath) input) =>
22
+ {
23
+ foreach (var set in results)
24
+ {
25
+ if (set.RepoRootPath == input.RepoRootPath &&
26
+ set.WorkspacePath == input.WorkspacePath)
27
+ {
28
+ return Task.FromResult(set.Result);
29
+ }
30
+ }
31
+
32
+ throw new NotImplementedException($"No saved response for {input}");
33
+ });
34
+ }
35
+ }
@@ -0,0 +1,39 @@
1
+ using NuGetUpdater.Core.Updater;
2
+
3
+ namespace NuGetUpdater.Core.Test;
4
+
5
+ internal class TestUpdaterWorker : IUpdaterWorker
6
+ {
7
+ private readonly Func<(string, string, string, string, string, bool), Task<UpdateOperationResult>> _getResult;
8
+
9
+ public TestUpdaterWorker(Func<(string, string, string, string, string, bool), Task<UpdateOperationResult>> getResult)
10
+ {
11
+ _getResult = getResult;
12
+ }
13
+
14
+ public Task<UpdateOperationResult> RunAsync(string repoRootPath, string workspacePath, string dependencyName, string previousDependencyVersion, string newDependencyVersion, bool isTransitive)
15
+ {
16
+ return _getResult((repoRootPath, workspacePath, dependencyName, previousDependencyVersion, newDependencyVersion, isTransitive));
17
+ }
18
+
19
+ public static TestUpdaterWorker FromResults(params (string RepoRootPath, string WorkspacePath, string DependencyName, string PreviousDependencyVersion, string NewDependencyVersion, bool IsTransitive, UpdateOperationResult Result)[] results)
20
+ {
21
+ return new TestUpdaterWorker(((string RepoRootPath, string WorkspacePath, string DependencyName, string PreviousDependencyVersion, string NewDependencyVersion, bool IsTransitive) input) =>
22
+ {
23
+ foreach (var set in results)
24
+ {
25
+ if (set.RepoRootPath == input.RepoRootPath &&
26
+ set.WorkspacePath == input.WorkspacePath &&
27
+ set.DependencyName == input.DependencyName &&
28
+ set.PreviousDependencyVersion == input.PreviousDependencyVersion &&
29
+ set.NewDependencyVersion == input.NewDependencyVersion &&
30
+ set.IsTransitive == input.IsTransitive)
31
+ {
32
+ return Task.FromResult(set.Result);
33
+ }
34
+ }
35
+
36
+ throw new NotImplementedException($"No saved response for {input}");
37
+ });
38
+ }
39
+ }
@@ -6,18 +6,27 @@ public class PackagesConfigUpdaterTests : TestBase
6
6
  {
7
7
  [Theory]
8
8
  [MemberData(nameof(PackagesDirectoryPathTestData))]
9
- public void PathToPackagesDirectoryCanBeDetermined(string projectContents, string dependencyName, string dependencyVersion, string expectedPackagesDirectoryPath)
9
+ public async Task PathToPackagesDirectoryCanBeDetermined(string projectContents, string? packagesConfigContents, string dependencyName, string dependencyVersion, string expectedPackagesDirectoryPath)
10
10
  {
11
+ using var tempDir = new TemporaryDirectory();
12
+ string? packagesConfigPath = null;
13
+ if (packagesConfigContents is not null)
14
+ {
15
+ packagesConfigPath = Path.Join(tempDir.DirectoryPath, "packages.config");
16
+ await File.WriteAllTextAsync(packagesConfigPath, packagesConfigContents);
17
+ }
18
+
11
19
  var projectBuildFile = ProjectBuildFile.Parse("/", "project.csproj", projectContents);
12
- var actualPackagesDirectorypath = PackagesConfigUpdater.GetPathToPackagesDirectory(projectBuildFile, dependencyName, dependencyVersion, "packages.config");
20
+ var actualPackagesDirectorypath = PackagesConfigUpdater.GetPathToPackagesDirectory(projectBuildFile, dependencyName, dependencyVersion, packagesConfigPath);
13
21
  Assert.Equal(expectedPackagesDirectoryPath, actualPackagesDirectorypath);
14
22
  }
15
23
 
16
- public static IEnumerable<object[]> PackagesDirectoryPathTestData()
24
+ public static IEnumerable<object?[]> PackagesDirectoryPathTestData()
17
25
  {
18
26
  // project with namespace
19
27
  yield return
20
28
  [
29
+ // project contents
21
30
  """
22
31
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
23
32
  <ItemGroup>
@@ -28,14 +37,20 @@ public class PackagesConfigUpdaterTests : TestBase
28
37
  </ItemGroup>
29
38
  </Project>
30
39
  """,
40
+ // packages.config contents
41
+ null,
42
+ // dependency name
31
43
  "Newtonsoft.Json",
44
+ // dependency version
32
45
  "7.0.1",
46
+ // expected packages directory path
33
47
  "../packages"
34
48
  ];
35
49
 
36
50
  // project without namespace
37
51
  yield return
38
52
  [
53
+ // project contents
39
54
  """
40
55
  <Project>
41
56
  <ItemGroup>
@@ -46,14 +61,20 @@ public class PackagesConfigUpdaterTests : TestBase
46
61
  </ItemGroup>
47
62
  </Project>
48
63
  """,
64
+ // packages.config contents
65
+ null,
66
+ // dependency name
49
67
  "Newtonsoft.Json",
68
+ // dependency version
50
69
  "7.0.1",
70
+ // expected packages directory path
51
71
  "../packages"
52
72
  ];
53
73
 
54
74
  // project with non-standard packages path
55
75
  yield return
56
76
  [
77
+ // project contents
57
78
  """
58
79
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
59
80
  <ItemGroup>
@@ -64,9 +85,89 @@ public class PackagesConfigUpdaterTests : TestBase
64
85
  </ItemGroup>
65
86
  </Project>
66
87
  """,
88
+ // packages.config contents
89
+ null,
90
+ // dependency name
67
91
  "Newtonsoft.Json",
92
+ // dependency version
68
93
  "7.0.1",
94
+ // expected packages directory path
69
95
  "../not-a-path-you-would-expect"
70
96
  ];
97
+
98
+ // project without expected packages path, but has others
99
+ yield return
100
+ [
101
+ // project contents
102
+ """
103
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
104
+ <ItemGroup>
105
+ <Reference Include="Some.Other.Package, Version=1.2.3.4, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed">
106
+ <HintPath>..\..\..\still-a-usable-path\Some.Other.Package.1.2.3\lib\net45\Some.Other.Package.dll</HintPath>
107
+ <Private>True</Private>
108
+ </Reference>
109
+ </ItemGroup>
110
+ </Project>
111
+ """,
112
+ // packages.config contents
113
+ """
114
+ <packages>
115
+ <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
116
+ </packages>
117
+ """,
118
+ // dependency name
119
+ "Newtonsoft.Json",
120
+ // dependency version
121
+ "7.0.1",
122
+ // expected packages directory path
123
+ "../../../still-a-usable-path"
124
+ ];
125
+
126
+ // project without expected package, but exists in packages.config, default is returned
127
+ yield return
128
+ [
129
+ // project contents
130
+ """
131
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
132
+ <ItemGroup>
133
+ </ItemGroup>
134
+ </Project>
135
+ """,
136
+ // packages.config contents
137
+ """
138
+ <packages>
139
+ <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
140
+ </packages>
141
+ """,
142
+ // dependency name
143
+ "Newtonsoft.Json",
144
+ // dependency version
145
+ "7.0.1",
146
+ // expected packages directory path
147
+ "../packages"
148
+ ];
149
+
150
+ // project without expected package and not in packages.config
151
+ yield return
152
+ [
153
+ // project contents
154
+ """
155
+ <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
156
+ <ItemGroup>
157
+ </ItemGroup>
158
+ </Project>
159
+ """,
160
+ // packages.config contents
161
+ """
162
+ <packages>
163
+ </packages>
164
+ """,
165
+ // dependency name
166
+ "Newtonsoft.Json",
167
+ // dependency version
168
+ "7.0.1",
169
+ // expected packages directory path
170
+ null
171
+ ];
71
172
  }
72
173
  }