@@ -264,71 +264,36 @@ public void UpdateProjectXmlVersionElementWithMultipleVersionElementsLastOneIsMo
264264 xmlRoot . ToString ( ) . ShouldBe ( expectedXml . ToString ( ) ) ;
265265 }
266266
267- [ TestCase ( """
268-
269- <Project Sdk="Microsoft.NET.Sdk">
270- <PropertyGroup>
271- <OutputType>Exe</OutputType>
272- <TargetFramework>net8.0</TargetFramework>
273- </PropertyGroup>
274- </Project>
275- """ ) ]
276- public void UpdateProjectFileAddsVersionToFile ( string xml )
277- {
278- var workingDirectory = FileSystemHelper . Path . GetTempPath ( ) ;
279- var fileName = FileSystemHelper . Path . Combine ( workingDirectory , "TestProject.csproj" ) ;
280-
281- VerifyAssemblyInfoFile ( xml , fileName , AssemblyVersioningScheme . MajorMinorPatch , ( fs , variables ) =>
282- {
283- using var projFileUpdater = new ProjectFileUpdater ( this . log , fs ) ;
284- projFileUpdater . Execute ( variables , new ( workingDirectory , false , fileName ) ) ;
285-
286- const string expectedXml = $ """
287- <Project Sdk="Microsoft.NET.Sdk">
288- <PropertyGroup>
289- <OutputType>Exe</OutputType>
290- <TargetFramework>{ TargetFramework } </TargetFramework>
291- <AssemblyVersion>2.3.1.0</AssemblyVersion>
292- <FileVersion>2.3.1.0</FileVersion>
293- <InformationalVersion>2.3.1+3.Branch.foo.Sha.hash</InformationalVersion>
294- <Version>2.3.1</Version>
295- </PropertyGroup>
296- </Project>
297- """ ;
298- var transformedXml = fs . File . ReadAllText ( fileName ) ;
299- transformedXml . ShouldBe ( XElement . Parse ( expectedXml ) . ToString ( ) ) ;
300- } ) ;
301- }
302-
303- [ TestCase ( """
304-
305- <Project Sdk="Microsoft.Build.Sql">
306- <PropertyGroup>
307- <TargetFramework>net8.0</TargetFramework>
308- </PropertyGroup>
309- </Project>
310- """ ) ]
311- public void UpdateSqlProjectFileAddsVersionToFile ( string xml )
267+ [ TestCase ( "Microsoft.NET.Sdk" , "TestProject.csproj" ) ]
268+ [ TestCase ( "Microsoft.Build.Sql" , "TestProject.sqlproj" ) ]
269+ public void UpdateProjectFileAddsVersionToFile ( string sdk , string projectName )
312270 {
271+ var xml = $ """
272+ <Project Sdk="{ sdk } ">
273+ <PropertyGroup>
274+ <TargetFramework>net8.0</TargetFramework>
275+ </PropertyGroup>
276+ </Project>
277+ """ ;
313278 var workingDirectory = FileSystemHelper . Path . GetTempPath ( ) ;
314- var fileName = FileSystemHelper . Path . Combine ( workingDirectory , "TestProject.sqlproj" ) ;
279+ var fileName = FileSystemHelper . Path . Combine ( workingDirectory , projectName ) ;
315280
316281 VerifyAssemblyInfoFile ( xml , fileName , AssemblyVersioningScheme . MajorMinorPatch , ( fs , variables ) =>
317282 {
318283 using var projFileUpdater = new ProjectFileUpdater ( this . log , fs ) ;
319284 projFileUpdater . Execute ( variables , new ( workingDirectory , false , fileName ) ) ;
320285
321- const string expectedXml = $ """
322- <Project Sdk="Microsoft.Build.Sql ">
323- <PropertyGroup>
324- <TargetFramework>{ TargetFramework } </TargetFramework>
325- <AssemblyVersion>2.3.1.0</AssemblyVersion>
326- <FileVersion>2.3.1.0</FileVersion>
327- <InformationalVersion>2.3.1+3.Branch.foo.Sha.hash</InformationalVersion>
328- <Version>2.3.1</Version>
329- </PropertyGroup>
330- </Project>
331- """ ;
286+ var expectedXml = $ """
287+ <Project Sdk="{ sdk } ">
288+ <PropertyGroup>
289+ <TargetFramework>{ TargetFramework } </TargetFramework>
290+ <AssemblyVersion>2.3.1.0</AssemblyVersion>
291+ <FileVersion>2.3.1.0</FileVersion>
292+ <InformationalVersion>2.3.1+3.Branch.foo.Sha.hash</InformationalVersion>
293+ <Version>2.3.1</Version>
294+ </PropertyGroup>
295+ </Project>
296+ """ ;
332297 var transformedXml = fs . File . ReadAllText ( fileName ) ;
333298 transformedXml . ShouldBe ( XElement . Parse ( expectedXml ) . ToString ( ) ) ;
334299 } ) ;
0 commit comments