@@ -424,8 +424,7 @@ private CSharpAutobuilder CreateAutoBuilder(bool isWindows,
424
424
return new CSharpAutobuilder ( actions , options ) ;
425
425
}
426
426
427
- [ Fact ]
428
- public void TestDefaultCSharpAutoBuilder ( )
427
+ private void SetupActionForDotnet ( )
429
428
{
430
429
actions . RunProcess [ "cmd.exe /C dotnet --info" ] = 0 ;
431
430
actions . RunProcess [ @"cmd.exe /C dotnet clean C:\Project\test.csproj" ] = 0 ;
@@ -438,20 +437,80 @@ public void TestDefaultCSharpAutoBuilder()
438
437
actions . GetEnvironmentVariable [ "CODEQL_EXTRACTOR_CSHARP_SCRATCH_DIR" ] = "scratch" ;
439
438
actions . EnumerateFiles [ @"C:\Project" ] = "foo.cs\n bar.cs\n test.csproj" ;
440
439
actions . EnumerateDirectories [ @"C:\Project" ] = "" ;
441
- var xml = new XmlDocument ( ) ;
442
- xml . LoadXml ( @"<Project Sdk=""Microsoft.NET.Sdk"">
443
- <PropertyGroup>
444
- <OutputType>Exe</OutputType>
445
- <TargetFramework>netcoreapp2.1</TargetFramework>
446
- </PropertyGroup>
440
+ }
447
441
448
- </Project>" ) ;
442
+ private void CreateAndVerifyDotnetScript ( XmlDocument xml )
443
+ {
449
444
actions . LoadXml [ @"C:\Project\test.csproj" ] = xml ;
450
445
451
446
var autobuilder = CreateAutoBuilder ( true ) ;
452
447
TestAutobuilderScript ( autobuilder , 0 , 4 ) ;
453
448
}
454
449
450
+ [ Fact ]
451
+ public void TestDefaultCSharpAutoBuilder1 ( )
452
+ {
453
+ SetupActionForDotnet ( ) ;
454
+ var xml = new XmlDocument ( ) ;
455
+ xml . LoadXml (
456
+ """
457
+ <Project Sdk="Microsoft.NET.Sdk">
458
+ <PropertyGroup>
459
+ <OutputType>Exe</OutputType>
460
+ <TargetFramework>netcoreapp2.1</TargetFramework>
461
+ </PropertyGroup>
462
+ </Project>
463
+ """ ) ;
464
+ CreateAndVerifyDotnetScript ( xml ) ;
465
+ }
466
+
467
+ [ Fact ]
468
+ public void TestDefaultCSharpAutoBuilder2 ( )
469
+ {
470
+ SetupActionForDotnet ( ) ;
471
+ var xml = new XmlDocument ( ) ;
472
+
473
+ xml . LoadXml (
474
+ """
475
+ <Project>
476
+ <Sdk Name="Microsoft.NET.Sdk" />
477
+
478
+ <PropertyGroup>
479
+ <OutputType>Exe</OutputType>
480
+ <TargetFramework>net9.0</TargetFramework>
481
+ <ImplicitUsings>enable</ImplicitUsings>
482
+ <Nullable>enable</Nullable>
483
+ </PropertyGroup>
484
+ </Project>
485
+ """
486
+ ) ;
487
+ CreateAndVerifyDotnetScript ( xml ) ;
488
+ }
489
+
490
+ [ Fact ]
491
+ public void TestDefaultCSharpAutoBuilder3 ( )
492
+ {
493
+ SetupActionForDotnet ( ) ;
494
+ var xml = new XmlDocument ( ) ;
495
+
496
+ xml . LoadXml (
497
+ """
498
+ <Project>
499
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
500
+
501
+ <PropertyGroup>
502
+ <OutputType>Exe</OutputType>
503
+ <TargetFramework>net9.0</TargetFramework>
504
+ <ImplicitUsings>enable</ImplicitUsings>
505
+ <Nullable>enable</Nullable>
506
+ </PropertyGroup>
507
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
508
+ </Project>
509
+ """
510
+ ) ;
511
+ CreateAndVerifyDotnetScript ( xml ) ;
512
+ }
513
+
455
514
[ Fact ]
456
515
public void TestLinuxCSharpAutoBuilder ( )
457
516
{
0 commit comments