@@ -78,71 +78,53 @@ public static void Constructor_LockedFileAsCodeBaseArgument_ShouldThrowFileLoad(
7878 string filename = Path . GetTempFileName ( ) ;
7979 using ( FileStream stream = new FileStream ( filename , FileMode . Open , FileAccess . Read , FileShare . None ) )
8080 {
81- Assert . Throws < FileLoadException > ( ( ) =>
82- {
83- var catalog = catalogCreator ( filename ) ;
84- } ) ;
81+ Assert . Throws < FileLoadException > ( ( ) => catalogCreator ( filename ) ) ;
8582 }
8683 }
8784
8885 public static void Constructor_NullFileNameAsCodeBaseArgument_ShouldThrowArgumentNull ( Func < string , AssemblyCatalog > catalogCreator )
8986 {
90- Assert . Throws < ArgumentNullException > ( "codeBase" , ( ) =>
91- {
92- var catalog = catalogCreator ( ( string ) null ) ;
93- } ) ;
87+ Assert . Throws < ArgumentNullException > ( "codeBase" , ( ) => catalogCreator ( null ) ) ;
9488 }
9589
9690 public static void Constructor_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument ( Func < string , AssemblyCatalog > catalogCreator )
9791 {
98- Assert . Throws < ArgumentException > ( "codeBase" , ( ) =>
99- {
100- var catalog = catalogCreator ( "" ) ;
101- } ) ;
92+ Assert . Throws < ArgumentException > ( "codeBase" , ( ) => catalogCreator ( "" ) ) ;
10293 }
10394
10495 public static void Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( Func < string , AssemblyCatalog > catalogCreator )
10596 {
106- Assert . Throws < ArgumentException > ( ( ) =>
107- {
108- var catalog = catalogCreator ( "??||>" ) ;
109- } ) ;
97+ Assert . Throws < ArgumentException > ( ( ) => catalogCreator ( "??||>" ) ) ;
98+ }
99+
100+ public static void Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO ( Func < string , AssemblyCatalog > catalogCreator )
101+ {
102+ Assert . ThrowsAny < IOException > ( ( ) => catalogCreator ( "??||>" ) ) ;
110103 }
111104
112105 public static void Constructor_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad ( Func < string , AssemblyCatalog > catalogCreator )
113106 {
114107 string directory = Environment . GetFolderPath ( Environment . SpecialFolder . System ) ;
115108 Assert . True ( Directory . Exists ( directory ) ) ;
116109
117- Assert . Throws < FileLoadException > ( ( ) =>
118- {
119- var catalog = catalogCreator ( directory ) ;
120- } ) ;
110+ Assert . Throws < FileLoadException > ( ( ) => catalogCreator ( directory ) ) ;
121111 }
122112
123113 public static void Constructor_TooLongFileNameAsCodeBaseArgument_ShouldThrowPathTooLong ( Func < string , AssemblyCatalog > catalogCreator )
124114 {
125115 Assert . Throws < PathTooLongException > ( ( ) =>
126- {
127- var catalog = catalogCreator ( @"c:\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\myassembly.dll" ) ;
128- } ) ;
116+ catalogCreator ( @"c:\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\This is a very long path\And Just to make sure\We will continue to make it very long\myassembly.dll" ) ) ;
129117 }
130118
131119 public static void Constructor_NonAssemblyFileNameAsCodeBaseArgument_ShouldThrowBadImageFormat ( Func < string , AssemblyCatalog > catalogCreator )
132120 {
133121 string filename = Path . GetTempFileName ( ) ;
134- Assert . Throws < BadImageFormatException > ( ( ) =>
135- {
136- var catalog = catalogCreator ( filename ) ;
137- } ) ;
122+ Assert . Throws < BadImageFormatException > ( ( ) => catalogCreator ( filename ) ) ;
138123 }
139124
140125 public static void Constructor_NonExistentFileNameAsCodeBaseArgument_ShouldThrowFileNotFound ( Func < string , AssemblyCatalog > catalogCreator )
141126 {
142- Assert . Throws < FileNotFoundException > ( ( ) =>
143- {
144- var catalog = catalogCreator ( @"FileThat should not ever exist" ) ;
145- } ) ;
127+ Assert . Throws < FileNotFoundException > ( ( ) => catalogCreator ( @"FileThat should not ever exist" ) ) ;
146128 }
147129
148130 // Test Assembly variant of the APIs
@@ -160,18 +142,12 @@ public static void Constructor_ValueAsAssemblyArgument_ShouldSetAssemblyProperty
160142
161143 public static void Constructor_NullReflectionContextArgument_ShouldThrowArgumentNull ( Func < ReflectionContext , AssemblyCatalog > catalogCreator )
162144 {
163- AssertExtensions . Throws < ArgumentNullException > ( "reflectionContext" , ( ) =>
164- {
165- var catalog = catalogCreator ( null ) ;
166- } ) ;
145+ AssertExtensions . Throws < ArgumentNullException > ( "reflectionContext" , ( ) => catalogCreator ( null ) ) ;
167146 }
168147
169148 public static void Constructor_NullDefinitionOriginArgument_ShouldThrowArgumentNull ( Func < ICompositionElement , AssemblyCatalog > catalogCreator )
170149 {
171- AssertExtensions . Throws < ArgumentNullException > ( "definitionOrigin" , ( ) =>
172- {
173- var catalog = catalogCreator ( null ) ;
174- } ) ;
150+ AssertExtensions . Throws < ArgumentNullException > ( "definitionOrigin" , ( ) => catalogCreator ( null ) ) ;
175151 }
176152
177153 //=========================================================================================================================================
@@ -215,15 +191,26 @@ public void Constructor1_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument()
215191 }
216192
217193 [ Fact ]
218- [ ActiveIssue ( 25498 , TestPlatforms . AnyUnix ) ]
219- public void Constructor1_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( )
194+ [ SkipOnTargetFramework ( ~ TargetFrameworkMonikers . NetFramework ) ]
195+ public void Constructor1_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument_Desktop ( )
220196 {
221197 AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( ( s ) =>
222198 {
223199 return new AssemblyCatalog ( s ) ;
224200 } ) ;
225201 }
226202
203+ [ Fact ]
204+ [ ActiveIssue ( 25498 ) ] // Also see https://github.com/dotnet/corefx/issues/27269
205+ [ SkipOnTargetFramework ( TargetFrameworkMonikers . NetFramework ) ]
206+ public void Constructor1_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO_Core ( )
207+ {
208+ AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO ( ( s ) =>
209+ {
210+ return new AssemblyCatalog ( s ) ;
211+ } ) ;
212+ }
213+
227214 [ Fact ]
228215 [ ActiveIssue ( 25498 ) ]
229216 public void Constructor1_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad ( )
@@ -314,15 +301,26 @@ public void Constructor2_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument()
314301 }
315302
316303 [ Fact ]
317- [ ActiveIssue ( 25498 , TestPlatforms . AnyUnix ) ]
318- public void Constructor2_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( )
304+ [ SkipOnTargetFramework ( ~ TargetFrameworkMonikers . NetFramework ) ]
305+ public void Constructor2_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument_Desktop ( )
319306 {
320307 AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( ( s ) =>
321308 {
322309 return new AssemblyCatalog ( s , new AssemblyCatalogTestsReflectionContext ( ) ) ;
323310 } ) ;
324311 }
325312
313+ [ Fact ]
314+ [ ActiveIssue ( 25498 ) ] // Also see https://github.com/dotnet/corefx/issues/27269
315+ [ SkipOnTargetFramework ( TargetFrameworkMonikers . NetFramework ) ]
316+ public void Constructor2_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( )
317+ {
318+ AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO ( ( s ) =>
319+ {
320+ return new AssemblyCatalog ( s , new AssemblyCatalogTestsReflectionContext ( ) ) ;
321+ } ) ;
322+ }
323+
326324 [ Fact ]
327325 [ ActiveIssue ( 25498 ) ]
328326 public void Constructor2_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad ( )
@@ -412,7 +410,7 @@ public void Constructor3_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument()
412410 }
413411
414412 [ Fact ]
415- [ ActiveIssue ( 25498 , TestPlatforms . AnyUnix ) ]
413+ [ SkipOnTargetFramework ( ~ TargetFrameworkMonikers . NetFramework ) ]
416414 public void Constructor3_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( )
417415 {
418416 AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( ( s ) =>
@@ -421,6 +419,17 @@ public void Constructor3_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument()
421419 } ) ;
422420 }
423421
422+ [ Fact ]
423+ [ ActiveIssue ( 25498 ) ] // // Also see https://github.com/dotnet/corefx/issues/27269
424+ [ SkipOnTargetFramework ( TargetFrameworkMonikers . NetFramework ) ]
425+ public void Constructor3_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO_Core ( )
426+ {
427+ AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO ( ( s ) =>
428+ {
429+ return new AssemblyCatalog ( s , ( ICompositionElement ) new AssemblyCatalog ( s ) ) ;
430+ } ) ;
431+ }
432+
424433 [ Fact ]
425434 [ ActiveIssue ( 25498 ) ]
426435 public void Constructor3_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad ( )
@@ -509,15 +518,26 @@ public void Constructor4_EmptyFileNameAsCodeBaseArgument_ShouldThrowArgument()
509518 }
510519
511520 [ Fact ]
512- [ ActiveIssue ( 25498 , TestPlatforms . AnyUnix ) ]
513- public void Constructor4_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( )
521+ [ SkipOnTargetFramework ( ~ TargetFrameworkMonikers . NetFramework ) ]
522+ public void Constructor4_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument_Desktop ( )
514523 {
515524 AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowArgument ( ( s ) =>
516525 {
517526 return new AssemblyCatalog ( s , new AssemblyCatalogTestsReflectionContext ( ) , ( ICompositionElement ) new AssemblyCatalog ( s ) ) ;
518527 } ) ;
519528 }
520529
530+ [ Fact ]
531+ [ ActiveIssue ( 25498 ) ] // Also see https://github.com/dotnet/corefx/issues/27269
532+ [ SkipOnTargetFramework ( TargetFrameworkMonikers . NetFramework ) ]
533+ public void Constructor4_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO_Core ( )
534+ {
535+ AssemblyCatalogConstructorTests . Constructor_InvalidFileNameAsCodeBaseArgument_ShouldThrowIO ( ( s ) =>
536+ {
537+ return new AssemblyCatalog ( s , new AssemblyCatalogTestsReflectionContext ( ) , ( ICompositionElement ) new AssemblyCatalog ( s ) ) ;
538+ } ) ;
539+ }
540+
521541 [ Fact ]
522542 [ ActiveIssue ( 25498 ) ]
523543 public void Constructor4_DirectoryAsCodeBaseArgument_ShouldThrowFileLoad ( )
@@ -780,10 +800,7 @@ public void GetExports_WhenCatalogDisposed_ShouldThrowObjectDisposed()
780800 catalog . Dispose ( ) ;
781801 var definition = ImportDefinitionFactory . Create ( ) ;
782802
783- ExceptionAssert . ThrowsDisposed ( catalog , ( ) =>
784- {
785- catalog . GetExports ( definition ) ;
786- } ) ;
803+ ExceptionAssert . ThrowsDisposed ( catalog , ( ) => catalog . GetExports ( definition ) ) ;
787804 }
788805
789806 [ Fact ]
@@ -792,10 +809,7 @@ public void GetExports_NullAsConstraintArgument_ShouldThrowArgumentNull()
792809 {
793810 var catalog = CreateAssemblyCatalog ( ) ;
794811
795- AssertExtensions . Throws < ArgumentNullException > ( "definition" , ( ) =>
796- {
797- catalog . GetExports ( ( ImportDefinition ) null ) ;
798- } ) ;
812+ AssertExtensions . Throws < ArgumentNullException > ( "definition" , ( ) => catalog . GetExports ( null ) ) ;
799813 }
800814
801815 [ Fact ]
0 commit comments