@@ -30,17 +30,22 @@ public void Unsigned(CancellationToken ct)
30
30
var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello.exe" ) ;
31
31
var ex = Assert . ThrowsAsync < Exception > ( ( ) =>
32
32
AuthenticodeDownloadValidator . Coder . ValidateAsync ( testBinaryPath , ct ) ) ;
33
- Assert . That ( ex . Message , Does . Contain ( "File is not signed and trusted with an Authenticode signature: State=Unsigned, StateReason=None" ) ) ;
33
+ Assert . That ( ex . Message ,
34
+ Does . Contain (
35
+ "File is not signed and trusted with an Authenticode signature: State=Unsigned, StateReason=None" ) ) ;
34
36
}
35
37
36
38
[ Test ( Description = "Test an untrusted binary" ) ]
37
39
[ CancelAfter ( 30_000 ) ]
38
40
public void Untrusted ( CancellationToken ct )
39
41
{
40
- var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello-self-signed.exe" ) ;
42
+ var testBinaryPath =
43
+ Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello-self-signed.exe" ) ;
41
44
var ex = Assert . ThrowsAsync < Exception > ( ( ) =>
42
45
AuthenticodeDownloadValidator . Coder . ValidateAsync ( testBinaryPath , ct ) ) ;
43
- Assert . That ( ex . Message , Does . Contain ( "File is not signed and trusted with an Authenticode signature: State=Unsigned, StateReason=UntrustedRoot" ) ) ;
46
+ Assert . That ( ex . Message ,
47
+ Does . Contain (
48
+ "File is not signed and trusted with an Authenticode signature: State=Unsigned, StateReason=UntrustedRoot" ) ) ;
44
49
}
45
50
46
51
[ Test ( Description = "Test an binary with a detached signature (catalog file)" ) ]
@@ -62,14 +67,17 @@ public void DifferentCertUntrusted(CancellationToken ct)
62
67
// this is installed.
63
68
var ex = Assert . ThrowsAsync < Exception > ( ( ) =>
64
69
AuthenticodeDownloadValidator . Coder . ValidateAsync ( @"C:\Program Files\dotnet\dotnet.exe" , ct ) ) ;
65
- Assert . That ( ex . Message , Does . Contain ( "File is signed by an unexpected certificate: ExpectedName='Coder Technologies Inc.', ActualName='.NET" ) ) ;
70
+ Assert . That ( ex . Message ,
71
+ Does . Contain (
72
+ "File is signed by an unexpected certificate: ExpectedName='Coder Technologies Inc.', ActualName='.NET" ) ) ;
66
73
}
67
74
68
75
[ Test ( Description = "Test a binary signed by Coder's certificate" ) ]
69
76
[ CancelAfter ( 30_000 ) ]
70
77
public async Task CoderSigned ( CancellationToken ct )
71
78
{
72
- var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello-versioned-signed.exe" ) ;
79
+ var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" ,
80
+ "hello-versioned-signed.exe" ) ;
73
81
await AuthenticodeDownloadValidator . Coder . ValidateAsync ( testBinaryPath , ct ) ;
74
82
}
75
83
}
@@ -91,7 +99,8 @@ public void NoVersion(CancellationToken ct)
91
99
[ CancelAfter ( 30_000 ) ]
92
100
public void InvalidVersion ( CancellationToken ct )
93
101
{
94
- var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello-invalid-version.exe" ) ;
102
+ var testBinaryPath =
103
+ Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello-invalid-version.exe" ) ;
95
104
var ex = Assert . ThrowsAsync < Exception > ( ( ) =>
96
105
new AssemblyVersionDownloadValidator ( 1 , 2 , 3 , 4 ) . ValidateAsync ( testBinaryPath , ct ) ) ;
97
106
Assert . That ( ex . Message , Does . Contain ( "File ProductVersion '1-2-3-4' is not a valid version string" ) ) ;
@@ -101,7 +110,8 @@ public void InvalidVersion(CancellationToken ct)
101
110
[ CancelAfter ( 30_000 ) ]
102
111
public void VersionMismatchFull ( CancellationToken ct )
103
112
{
104
- var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello-versioned-signed.exe" ) ;
113
+ var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" ,
114
+ "hello-versioned-signed.exe" ) ;
105
115
106
116
// Try changing each version component one at a time
107
117
var expectedVersions = new [ ] { 1 , 2 , 3 , 4 } ;
@@ -124,7 +134,8 @@ public void VersionMismatchFull(CancellationToken ct)
124
134
[ CancelAfter ( 30_000 ) ]
125
135
public async Task VersionMatch ( CancellationToken ct )
126
136
{
127
- var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" , "hello-versioned-signed.exe" ) ;
137
+ var testBinaryPath = Path . Combine ( TestContext . CurrentContext . TestDirectory , "testdata" ,
138
+ "hello-versioned-signed.exe" ) ;
128
139
129
140
// Test with just major.minor
130
141
await new AssemblyVersionDownloadValidator ( 1 , 2 ) . ValidateAsync ( testBinaryPath , ct ) ;
0 commit comments