|
| 1 | +using Xunit; |
| 2 | +using Xunit.Abstractions; |
| 3 | + |
| 4 | +namespace NuGetizer |
| 5 | +{ |
| 6 | + public class given_transitive_projects |
| 7 | + { |
| 8 | + readonly ITestOutputHelper output; |
| 9 | + |
| 10 | + public given_transitive_projects(ITestOutputHelper output) |
| 11 | + { |
| 12 | + this.output = output; |
| 13 | + using var disable = OpenBuildLogAttribute.Disable(); |
| 14 | + |
| 15 | + Builder.BuildScenario(nameof(given_transitive_projects), target: "Restore", projectName: "Project1") |
| 16 | + .AssertSuccess(output); |
| 17 | + |
| 18 | + Builder.BuildScenario(nameof(given_transitive_projects), target: "Build", projectName: "Project1") |
| 19 | + .AssertSuccess(output); |
| 20 | + } |
| 21 | + |
| 22 | + [Fact] |
| 23 | + public void when_pack_no_build_then_succeeds() |
| 24 | + { |
| 25 | + var result = Builder.BuildScenario(nameof(given_transitive_projects), |
| 26 | + projectName: "Project1", |
| 27 | + // These are the properties passed by dotnet pack --no-build |
| 28 | + properties: new { NoBuild = "true", _IsPacking = "true" }, |
| 29 | + target: "GetPackageContents,Pack"); |
| 30 | + |
| 31 | + result.AssertSuccess(output); |
| 32 | + |
| 33 | + Assert.True(result.BuildResult.HasResultsForTarget("GetPackageContents")); |
| 34 | + |
| 35 | + var items = result.BuildResult.ResultsByTarget["GetPackageContents"]; |
| 36 | + |
| 37 | + Assert.Contains(items.Items, item => item.Matches(new |
| 38 | + { |
| 39 | + PackagePath = "lib/net8.0/Project1.dll" |
| 40 | + })); |
| 41 | + |
| 42 | + Assert.Contains(items.Items, item => item.Matches(new |
| 43 | + { |
| 44 | + PackagePath = "lib/net8.0/Project2.dll" |
| 45 | + })); |
| 46 | + |
| 47 | + Assert.Contains(items.Items, item => item.Matches(new |
| 48 | + { |
| 49 | + PackagePath = "lib/net8.0/Project3.dll" |
| 50 | + })); |
| 51 | + } |
| 52 | + } |
| 53 | +} |
0 commit comments