@@ -32,7 +32,9 @@ public void GivenAnExecutablePathItCanGenerateShimFile()
3232 ShellShimRepository shellShimRepository = ConfigBasicTestDependencyShellShimRepository ( pathToShim ) ;
3333 var shellCommandName = nameof ( ShellShimRepositoryTests ) + Path . GetRandomFileName ( ) ;
3434
35- shellShimRepository . CreateShim ( outputDll , new ToolCommandName ( shellCommandName ) ) ;
35+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , outputDll ) ;
36+
37+ shellShimRepository . CreateShim ( command ) ;
3638
3739 var stdOut = ExecuteInShell ( shellCommandName , pathToShim ) ;
3840
@@ -53,7 +55,8 @@ public void GivenAnExecutableAndRelativePathToShimPathItCanGenerateShimFile()
5355 ShellShimRepository shellShimRepository = ConfigBasicTestDependencyShellShimRepository ( relativePathToShim ) ;
5456 var shellCommandName = nameof ( ShellShimRepositoryTests ) + Path . GetRandomFileName ( ) ;
5557
56- shellShimRepository . CreateShim ( outputDll , new ToolCommandName ( shellCommandName ) ) ;
58+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , outputDll ) ;
59+ shellShimRepository . CreateShim ( command ) ;
5760
5861 var stdOut = ExecuteInShell ( shellCommandName , relativePathToShim ) ;
5962
@@ -75,11 +78,13 @@ public void GivenAnExecutablePathItCanGenerateShimFileInTransaction()
7578 var shellShimRepository = ConfigBasicTestDependencyShellShimRepository ( pathToShim ) ;
7679 var shellCommandName = nameof ( ShellShimRepositoryTests ) + Path . GetRandomFileName ( ) ;
7780
81+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , outputDll ) ;
82+
7883 using ( var transactionScope = new TransactionScope (
7984 TransactionScopeOption . Required ,
8085 TimeSpan . Zero ) )
8186 {
82- shellShimRepository . CreateShim ( outputDll , new ToolCommandName ( shellCommandName ) ) ;
87+ shellShimRepository . CreateShim ( command ) ;
8388 transactionScope . Complete ( ) ;
8489 }
8590
@@ -96,8 +101,9 @@ public void GivenAnExecutablePathDirectoryThatDoesNotExistItCanGenerateShimFile(
96101 var extraNonExistDirectory = Path . GetRandomFileName ( ) ;
97102 var shellShimRepository = new ShellShimRepository ( new DirectoryPath ( Path . Combine ( testFolder , extraNonExistDirectory ) ) , GetAppHostTemplateFromStage2 ( ) ) ;
98103 var shellCommandName = nameof ( ShellShimRepositoryTests ) + Path . GetRandomFileName ( ) ;
104+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , outputDll ) ;
99105
100- Action a = ( ) => shellShimRepository . CreateShim ( outputDll , new ToolCommandName ( shellCommandName ) ) ;
106+ Action a = ( ) => shellShimRepository . CreateShim ( command ) ;
101107
102108 a . Should ( ) . NotThrow < DirectoryNotFoundException > ( ) ;
103109 }
@@ -112,8 +118,9 @@ public void GivenAShimItPassesThroughArguments(string arguments, string[] expect
112118 var pathToShim = GetNewCleanFolderUnderTempRoot ( ) ;
113119 var shellShimRepository = ConfigBasicTestDependencyShellShimRepository ( pathToShim ) ;
114120 var shellCommandName = nameof ( ShellShimRepositoryTests ) + Path . GetRandomFileName ( ) ;
121+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , outputDll ) ;
115122
116- shellShimRepository . CreateShim ( outputDll , new ToolCommandName ( shellCommandName ) ) ;
123+ shellShimRepository . CreateShim ( command ) ;
117124
118125 var stdOut = ExecuteInShell ( shellCommandName , pathToShim , arguments ) ;
119126
@@ -142,13 +149,15 @@ public void GivenAShimConflictItWillRollback(bool testMockBehaviorIsInSync)
142149 shellShimRepository = ConfigBasicTestDependencyShellShimRepository ( pathToShim ) ;
143150 }
144151
152+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , new FilePath ( "dummy.dll" ) ) ;
153+
145154 Action a = ( ) =>
146155 {
147156 using ( var scope = new TransactionScope (
148157 TransactionScopeOption . Required ,
149158 TimeSpan . Zero ) )
150159 {
151- shellShimRepository . CreateShim ( new FilePath ( "dummy.dll" ) , new ToolCommandName ( shellCommandName ) ) ;
160+ shellShimRepository . CreateShim ( command ) ;
152161
153162 scope . Complete ( ) ;
154163 }
@@ -184,16 +193,21 @@ public void GivenAnExceptionItWillRollback(bool testMockBehaviorIsInSync)
184193 shellShimRepository = ConfigBasicTestDependencyShellShimRepository ( pathToShim ) ;
185194 }
186195
196+
197+
187198 Action intendedError = ( ) => throw new ToolPackageException ( "simulated error" ) ;
188199
200+
201+
189202 Action a = ( ) =>
190203 {
191204 using ( var scope = new TransactionScope (
192205 TransactionScopeOption . Required ,
193206 TimeSpan . Zero ) )
194207 {
195208 FilePath targetExecutablePath = MakeHelloWorldExecutableDll ( identifier : testMockBehaviorIsInSync . ToString ( ) ) ;
196- shellShimRepository . CreateShim ( targetExecutablePath , new ToolCommandName ( shellCommandName ) ) ;
209+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , targetExecutablePath ) ;
210+ shellShimRepository . CreateShim ( command ) ;
197211
198212 intendedError ( ) ;
199213 scope . Complete ( ) ;
@@ -224,7 +238,9 @@ public void GivenANonexistentShimRemoveDoesNotThrow(bool testMockBehaviorIsInSyn
224238
225239 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
226240
227- shellShimRepository . RemoveShim ( new ToolCommandName ( shellCommandName ) ) ;
241+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , new FilePath ( "dummyExe" ) ) ;
242+
243+ shellShimRepository . RemoveShim ( command ) ;
228244
229245 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
230246 }
@@ -250,11 +266,12 @@ public void GivenAnInstalledShimRemoveDeletesTheShimFiles(bool testMockBehaviorI
250266 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
251267
252268 FilePath targetExecutablePath = MakeHelloWorldExecutableDll ( identifier : testMockBehaviorIsInSync . ToString ( ) ) ;
253- shellShimRepository . CreateShim ( targetExecutablePath , new ToolCommandName ( shellCommandName ) ) ;
269+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , targetExecutablePath ) ;
270+ shellShimRepository . CreateShim ( command ) ;
254271
255272 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . NotBeEmpty ( ) ;
256273
257- shellShimRepository . RemoveShim ( new ToolCommandName ( shellCommandName ) ) ;
274+ shellShimRepository . RemoveShim ( command ) ;
258275
259276 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
260277 }
@@ -280,15 +297,16 @@ public void GivenAnInstalledShimRemoveRollsbackIfTransactionIsAborted(bool testM
280297 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
281298
282299 FilePath targetExecutablePath = MakeHelloWorldExecutableDll ( identifier : testMockBehaviorIsInSync . ToString ( ) ) ;
283- shellShimRepository . CreateShim ( targetExecutablePath , new ToolCommandName ( shellCommandName ) ) ;
300+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , targetExecutablePath ) ;
301+ shellShimRepository . CreateShim ( command ) ;
284302
285303 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . NotBeEmpty ( ) ;
286304
287305 using ( var scope = new TransactionScope (
288306 TransactionScopeOption . Required ,
289307 TimeSpan . Zero ) )
290308 {
291- shellShimRepository . RemoveShim ( new ToolCommandName ( shellCommandName ) ) ;
309+ shellShimRepository . RemoveShim ( command ) ;
292310
293311 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
294312 }
@@ -317,15 +335,16 @@ public void GivenAnInstalledShimRemoveCommitsIfTransactionIsCompleted(bool testM
317335 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
318336
319337 FilePath targetExecutablePath = MakeHelloWorldExecutableDll ( identifier : testMockBehaviorIsInSync . ToString ( ) ) ;
320- shellShimRepository . CreateShim ( targetExecutablePath , new ToolCommandName ( shellCommandName ) ) ;
338+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , targetExecutablePath ) ;
339+ shellShimRepository . CreateShim ( command ) ;
321340
322341 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . NotBeEmpty ( ) ;
323342
324343 using ( var scope = new TransactionScope (
325344 TransactionScopeOption . Required ,
326345 TimeSpan . Zero ) )
327346 {
328- shellShimRepository . RemoveShim ( new ToolCommandName ( shellCommandName ) ) ;
347+ shellShimRepository . RemoveShim ( command ) ;
329348
330349 Directory . EnumerateFileSystemEntries ( pathToShim ) . Should ( ) . BeEmpty ( ) ;
331350
@@ -354,9 +373,10 @@ public void WhenPackagedShimProvidedItCopies()
354373
355374 ShellShimRepository shellShimRepository = GetShellShimRepositoryWithMockMaker ( pathToShim ) ;
356375
376+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , new FilePath ( "dummy.dll" ) ) ;
377+
357378 shellShimRepository . CreateShim (
358- new FilePath ( "dummy.dll" ) ,
359- new ToolCommandName ( shellCommandName ) ,
379+ command ,
360380 new [ ] { new FilePath ( dummyShimPath ) } ) ;
361381
362382 var createdShim = Directory . EnumerateFileSystemEntries ( pathToShim ) . Single ( ) ;
@@ -383,9 +403,10 @@ public void WhenMultipleSameNamePackagedShimProvidedItThrows()
383403
384404 FilePath [ ] filePaths = new [ ] { new FilePath ( dummyShimPath ) , new FilePath ( "path" + dummyShimPath ) } ;
385405
406+ var command = new ToolCommand ( new ToolCommandName ( shellCommandName ) , "dotnet" , new FilePath ( "dummy.dll" ) ) ;
407+
386408 Action a = ( ) => shellShimRepository . CreateShim (
387- new FilePath ( "dummy.dll" ) ,
388- new ToolCommandName ( shellCommandName ) ,
409+ command ,
389410 new [ ] { new FilePath ( dummyShimPath ) , new FilePath ( "path" + dummyShimPath ) } ) ;
390411
391412 a . Should ( ) . Throw < ShellShimException > ( )
0 commit comments