@@ -176,4 +176,76 @@ private static GeneratorOptions GetGeneratorOptions(GeneratorTestCaseAttribute t
176176
177177 return options ;
178178 }
179+
180+ [ Test ]
181+ public void GenerateTypeDeclaration_ArgumentOptionsNull ( )
182+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateTypeDeclaration ( t : typeof ( int ) , null , options : null ! ) ) ;
183+
184+ [ Test ]
185+ public void GenerateTypeDeclaration_ArgumentTypeNull ( )
186+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateTypeDeclaration ( t : null ! , null , options : new ( ) ) ) ;
187+
188+ [ TestCase ( typeof ( List < int > ) ) ]
189+ [ TestCase ( typeof ( IEnumerable < int > ) ) ]
190+ [ TestCase ( typeof ( Action < int > ) ) ]
191+ [ TestCase ( typeof ( int ? ) ) ]
192+ [ TestCase ( typeof ( ( int , int ) ) ) ]
193+ public void GenerateTypeDeclaration_ArgumentTypeIsConstructedGenericType ( Type type )
194+ => Assert . Throws < ArgumentException > ( ( ) => Generator . GenerateTypeDeclaration ( t : type , null , options : new ( ) ) ) ;
195+
196+ [ Test ]
197+ public void GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces_ArgumentOptionsNull ( )
198+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces ( t : typeof ( int ) , null , options : null ! ) ) ;
199+
200+ [ Test ]
201+ public void GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces_ArgumentTypeNull ( )
202+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces ( t : null ! , null , options : new ( ) ) ) ;
203+
204+ [ TestCase ( typeof ( List < int > ) ) ]
205+ [ TestCase ( typeof ( IEnumerable < int > ) ) ]
206+ [ TestCase ( typeof ( Action < int > ) ) ]
207+ [ TestCase ( typeof ( int ? ) ) ]
208+ [ TestCase ( typeof ( ( int , int ) ) ) ]
209+ public void GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces_ArgumentTypeIsConstructedGenericType ( Type type )
210+ => Assert . Throws < ArgumentException > ( ( ) => Generator . GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces ( t : type , null , options : new ( ) ) ) ;
211+
212+ [ Test ]
213+ public void GenerateMemberDeclaration_ArgumentOptionsNull ( )
214+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateMemberDeclaration ( member : typeof ( int ) . GetMembers ( ) . First ( ) , null , options : null ! ) ) ;
215+
216+ [ Test ]
217+ public void GenerateMemberDeclaration_ArgumentTypeNull ( )
218+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateMemberDeclaration ( member : null ! , null , options : new ( ) ) ) ;
219+
220+ [ Test ]
221+ public void GenerateGenericParameterConstraintDeclaration_ArgumentOptionsNull ( )
222+ {
223+ var genericParameter = typeof ( List < > ) . GetGenericArguments ( ) [ 0 ] ;
224+
225+ Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateGenericParameterConstraintDeclaration ( genericParameter : genericParameter , null , options : null ! ) ) ;
226+ }
227+
228+ [ Test ]
229+ public void GenerateGenericParameterConstraintDeclaration_ArgumentGenericParameterNull ( )
230+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateGenericParameterConstraintDeclaration ( genericParameter : null ! , null , options : new ( ) ) ) ;
231+
232+ [ TestCase ( typeof ( int ) ) ]
233+ [ TestCase ( typeof ( List < > ) ) ]
234+ public void GenerateGenericParameterConstraintDeclaration_ArgumentGenericParameterIsType ( Type type )
235+ => Assert . Throws < ArgumentException > ( ( ) => Generator . GenerateGenericParameterConstraintDeclaration ( genericParameter : type , null , options : new ( ) ) ) ;
236+
237+ [ TestCase ( typeof ( List < int > ) ) ]
238+ [ TestCase ( typeof ( Action < int > ) ) ]
239+ [ TestCase ( typeof ( int ? ) ) ]
240+ [ TestCase ( typeof ( ( int , int ) ) ) ]
241+ public void GenerateGenericParameterConstraintDeclaration_ArgumentGenericParameterIsGenericArgument ( Type type )
242+ => Assert . Throws < ArgumentException > ( ( ) => Generator . GenerateGenericParameterConstraintDeclaration ( genericParameter : type . GetGenericArguments ( ) [ 0 ] , null , options : new ( ) ) ) ;
243+
244+ [ Test ]
245+ public void GenerateExplicitBaseTypeAndInterfaces_ArgumentOptionsNull ( )
246+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateExplicitBaseTypeAndInterfaces ( t : typeof ( int ) , null , options : null ! ) ) ;
247+
248+ [ Test ]
249+ public void GenerateExplicitBaseTypeAndInterfaces_ArgumentTypeNull ( )
250+ => Assert . Throws < ArgumentNullException > ( ( ) => Generator . GenerateExplicitBaseTypeAndInterfaces ( t : null ! , null , options : new ( ) ) ) ;
179251}
0 commit comments