3
3
4
4
using System ;
5
5
using System . Collections . Generic ;
6
+ using System . Diagnostics ;
6
7
using System . IO ;
7
8
using System . Runtime . InteropServices ;
8
9
using Xunit ;
@@ -20,10 +21,10 @@ public enum PackageType
20
21
21
22
public static IEnumerable < object [ ] > Data => new List < object [ ] >
22
23
{
23
- new object [ ] { "System.Xml.ReaderWriter" , "4.0.11 " , PackageType . Reference } ,
24
- new object [ ] { "Microsoft.Extensions.Logging.Abstractions" , "7 .0.1 " , PackageType . Reference } ,
24
+ new object [ ] { "System.Xml.ReaderWriter" , "4.3.0 " , PackageType . Reference } ,
25
+ new object [ ] { "Microsoft.Extensions.Logging.Abstractions" , "6 .0.4 " , PackageType . Reference } ,
25
26
new object [ ] { "Microsoft.CodeAnalysis.CSharp" , "3.11.0" , PackageType . Reference } ,
26
- new object [ ] { "System.Security.Cryptography.Pkcs " , "7.0.2 " , PackageType . Reference } ,
27
+ new object [ ] { "System.Security.Cryptography.Encoding " , "4.3.0 " , PackageType . Reference } ,
27
28
new object [ ] { "Microsoft.Build.NoTargets" , "3.7.0" , PackageType . Text } ,
28
29
} ;
29
30
@@ -43,7 +44,7 @@ public void VerifyGenerateScript(string package, string version, PackageType typ
43
44
{
44
45
string command = Path . Combine ( PathUtilities . GetRepoRoot ( ) , RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) ? "generate.cmd" : "generate.sh" ) ;
45
46
string arguments = $ "-p { package } ,{ version } -x -d { SandboxDirectory } ";
46
- string pkgSrcDirectory = string . Empty ;
47
+ string pkgSrcDirectory ;
47
48
string pkgSandboxDirectory = Path . Combine ( SandboxDirectory , package . ToLower ( ) , version ) ;
48
49
49
50
switch ( type )
@@ -55,15 +56,26 @@ public void VerifyGenerateScript(string package, string version, PackageType typ
55
56
arguments += " -t text" ;
56
57
pkgSrcDirectory = Path . Combine ( PathUtilities . GetRepoRoot ( ) , "src" , "textOnlyPackages" , "src" , package . ToLower ( ) , version ) ;
57
58
break ;
59
+ default :
60
+ throw new ArgumentException ( $ "Unknown package type '{ type } '") ;
58
61
}
59
62
63
+ Assert . True ( Directory . Exists ( pkgSrcDirectory ) , $ "Source directory '{ pkgSrcDirectory } ' does not exist.") ;
64
+
60
65
ExecuteHelper . ExecuteProcessValidateExitCode ( command , arguments , Output ) ;
61
66
62
- string diff = ExecuteHelper . ExecuteProcess ( "git" , $ "diff --no-index { pkgSrcDirectory } { pkgSandboxDirectory } ", Output , true ) . StdOut ;
67
+ ( Process Process , string StdOut , string StdErr ) result =
68
+ ExecuteHelper . ExecuteProcess ( "git" , $ "diff --no-index { pkgSrcDirectory } { pkgSandboxDirectory } ", Output , true ) ;
69
+
70
+ string diff = result . StdOut ;
63
71
if ( diff != string . Empty )
64
72
{
65
- Assert . Fail ( $ "Regenerated package '{ package } ' does not match the checked-in content. { Environment . NewLine } "
73
+ Assert . Fail ( $ "Regenerated package '{ package } , { version } ' does not match the checked-in content. { Environment . NewLine } "
66
74
+ $ "{ diff } { Environment . NewLine } ") ;
67
75
}
76
+ else if ( result . Process . ExitCode != 0 )
77
+ {
78
+ Assert . Fail ( $ "Unexpected git diff failure on '{ package } , { version } '. { Environment . NewLine } { result . StdErr } { Environment . NewLine } ") ;
79
+ }
68
80
}
69
81
}
0 commit comments