|
5 | 5 | // ----------------------------------------------------------------------- |
6 | 6 |
|
7 | 7 | using System; |
| 8 | +using System.Collections.Generic; |
8 | 9 | using System.IO; |
9 | 10 | using System.Runtime.Loader; |
10 | 11 | using System.Xml.Linq; |
@@ -42,12 +43,16 @@ public BuildTaskTests( TestContext ctx ) |
42 | 43 | [DataRow("net8.0")] |
43 | 44 | public void ValidateRepoAssemblyVersion( string targetFramework) |
44 | 45 | { |
45 | | - using var collection = new ProjectCollection(); |
| 46 | + var globalProperties = new Dictionary<string,string> |
| 47 | + { |
| 48 | + ["BuildVersionXml"] = Path.Combine(RepoRoot, "BuildVersion.xml"), |
| 49 | + }; |
| 50 | + |
| 51 | + using var collection = new ProjectCollection(globalProperties); |
46 | 52 |
|
47 | 53 | var (testProject, props) = CreateTestProjectAndInvokeTestedPackage( |
48 | 54 | targetFramework, |
49 | | - pc => pc.Property( "BuildVersionXml", Path.Combine(RepoRoot, "BuildVersion.xml")), |
50 | | - collection |
| 55 | + projectCollection: collection |
51 | 56 | ); |
52 | 57 | string? taskAssembly = testProject.ProjectInstance.GetOptionalProperty("_Ubiquity_NET_Versioning_Build_Tasks"); |
53 | 58 | Assert.IsNotNull( taskAssembly, "Task assembly property should contain full path to the task DLL (Not NULL)" ); |
@@ -89,15 +94,18 @@ public void ValidateRepoAssemblyVersion( string targetFramework) |
89 | 94 | [DataRow("net8.0")] |
90 | 95 | public void GoldenPathTest( string targetFramework ) |
91 | 96 | { |
92 | | - using var collection = new ProjectCollection(); |
| 97 | + var globalProperties = new Dictionary<string,string> |
| 98 | + { |
| 99 | + ["BuildMajor"] = "20", |
| 100 | + ["BuildMinor"] = "1", |
| 101 | + ["BuildPatch"] = "4", |
| 102 | + ["PreReleaseName"] = "alpha", |
| 103 | + }; |
| 104 | + |
| 105 | + using var collection = new ProjectCollection(globalProperties); |
93 | 106 | var (testProject, props) = CreateTestProjectAndInvokeTestedPackage( |
94 | 107 | targetFramework, |
95 | | - pc => pc.PropertyGroup() |
96 | | - .Property("BuildMajor", "20") |
97 | | - .Property("BuildMinor", "1") |
98 | | - .Property("BuildPatch", "4") |
99 | | - .Property("PreReleaseName", "alpha"), |
100 | | - collection |
| 108 | + projectCollection: collection |
101 | 109 | ); |
102 | 110 |
|
103 | 111 | // v20.1.4-alpha => 5.44854.3875.59946 [see: https://csemver.org/playground/site/#/] |
@@ -157,18 +165,21 @@ public void GoldenPathTest( string targetFramework ) |
157 | 165 | [DataRow("net8.0")] |
158 | 166 | public void BuildVersionXmlIsUsed( string targetFramework) |
159 | 167 | { |
160 | | - using var collection = new ProjectCollection(); |
161 | 168 | string buildVersionXml = CreateBuildVersionXml(20, 1, 5); |
162 | 169 | string buildTime = DateTime.UtcNow.ToString( "o" ); |
163 | 170 | const string buildIndex = "ABCDEF12"; |
| 171 | + var globalProperties = new Dictionary<string, string> |
| 172 | + { |
| 173 | + ["BuildTime"] = buildTime, |
| 174 | + ["CiBuildIndex"] = buildIndex, |
| 175 | + ["BuildVersionXml"] = buildVersionXml |
| 176 | + }; |
| 177 | + |
| 178 | + using var collection = new ProjectCollection(globalProperties); |
164 | 179 |
|
165 | 180 | var (testProject, props) = CreateTestProjectAndInvokeTestedPackage( |
166 | 181 | targetFramework, |
167 | | - pc => pc.PropertyGroup() |
168 | | - .Property( "BuildTime", buildTime ) |
169 | | - .Property( "CiBuildIndex", buildIndex ) |
170 | | - .Property( "BuildVersionXml", buildVersionXml ), |
171 | | - collection |
| 182 | + projectCollection: collection |
172 | 183 | ); |
173 | 184 |
|
174 | 185 | // v20.1.5 => 5.44854.3880.52268 [see: https://csemver.org/playground/site/#/] |
|
0 commit comments