@@ -217,6 +217,117 @@ public void ValidateTransferUtilityUploadResponseDefinitionCompleteness()
217217 "TransferUtilityUploadResponse" ) ;
218218 }
219219
220+ [ TestMethod ]
221+ [ TestCategory ( "S3" ) ]
222+ public void MapCompleteMultipartUploadResponse_AllMappedProperties_WorkCorrectly ( )
223+ {
224+ // Get the expected mappings from JSON
225+ var completeMultipartMappings = _mappingJson . RootElement
226+ . GetProperty ( "Conversion" )
227+ . GetProperty ( "CompleteMultipartResponse" )
228+ . GetProperty ( "UploadResponse" )
229+ . EnumerateArray ( )
230+ . Select ( prop => prop . GetString ( ) )
231+ . ToList ( ) ;
232+
233+ // Create source object with dynamically generated test data
234+ var sourceResponse = new CompleteMultipartUploadResponse ( ) ;
235+ var sourceType = typeof ( CompleteMultipartUploadResponse ) ;
236+ var testDataValues = new Dictionary < string , object > ( ) ;
237+
238+ // Generate test data for each mapped property
239+ foreach ( var propertyName in completeMultipartMappings )
240+ {
241+ // Resolve alias to actual property name
242+ var resolvedPropertyName = ResolvePropertyName ( propertyName ) ;
243+ var sourceProperty = sourceType . GetProperty ( resolvedPropertyName ) ;
244+ if ( sourceProperty ? . CanWrite == true )
245+ {
246+ var testValue = GenerateTestValue ( sourceProperty . PropertyType , propertyName ) ;
247+ sourceProperty . SetValue ( sourceResponse , testValue ) ;
248+ testDataValues [ propertyName ] = testValue ;
249+ }
250+ }
251+
252+ // Add inherited properties for comprehensive testing
253+ sourceResponse . HttpStatusCode = HttpStatusCode . OK ;
254+ sourceResponse . ContentLength = 2048 ;
255+
256+ // Map the response
257+ var mappedResponse = ResponseMapper . MapCompleteMultipartUploadResponse ( sourceResponse ) ;
258+ Assert . IsNotNull ( mappedResponse , "Mapped response should not be null" ) ;
259+
260+ // Verify all mapped properties using reflection
261+ var targetType = typeof ( TransferUtilityUploadResponse ) ;
262+ var failedAssertions = new List < string > ( ) ;
263+
264+ foreach ( var propertyName in completeMultipartMappings )
265+ {
266+ // Resolve alias to actual property name for reflection lookups
267+ var resolvedPropertyName = ResolvePropertyName ( propertyName ) ;
268+ var sourceProperty = sourceType . GetProperty ( resolvedPropertyName ) ;
269+ var targetProperty = targetType . GetProperty ( resolvedPropertyName ) ;
270+
271+ if ( sourceProperty == null )
272+ {
273+ failedAssertions . Add ( $ "Source property '{ propertyName } ' (resolved to: { resolvedPropertyName } ) not found in CompleteMultipartUploadResponse") ;
274+ continue ;
275+ }
276+
277+ if ( targetProperty == null )
278+ {
279+ failedAssertions . Add ( $ "Target property '{ propertyName } ' (resolved to: { resolvedPropertyName } ) not found in TransferUtilityUploadResponse") ;
280+ continue ;
281+ }
282+
283+ var sourceValue = sourceProperty . GetValue ( sourceResponse ) ;
284+ var targetValue = targetProperty . GetValue ( mappedResponse ) ;
285+
286+ // Special handling for complex object comparisons
287+ if ( ! AreValuesEqual ( sourceValue , targetValue ) )
288+ {
289+ failedAssertions . Add ( $ "{ propertyName } : Expected '{ sourceValue ?? "null" } ', got '{ targetValue ?? "null" } '") ;
290+ }
291+ }
292+
293+ // Test inherited properties
294+ Assert . AreEqual ( sourceResponse . HttpStatusCode , mappedResponse . HttpStatusCode , "HttpStatusCode should match" ) ;
295+ Assert . AreEqual ( sourceResponse . ContentLength , mappedResponse . ContentLength , "ContentLength should match" ) ;
296+
297+ // Report any failures
298+ if ( failedAssertions . Any ( ) )
299+ {
300+ Assert . Fail ( $ "Property mapping failures:\n { string . Join ( "\n " , failedAssertions ) } ") ;
301+ }
302+ }
303+
304+ [ TestMethod ]
305+ [ TestCategory ( "S3" ) ]
306+ public void MapCompleteMultipartUploadResponse_NullValues_HandledCorrectly ( )
307+ {
308+ // Test null handling scenarios
309+ var testCases = new [ ]
310+ {
311+ // Test null Expiration
312+ new CompleteMultipartUploadResponse { Expiration = null } ,
313+
314+ // Test null enum conversions
315+ new CompleteMultipartUploadResponse { ChecksumType = null , RequestCharged = null , ServerSideEncryption = null }
316+ } ;
317+
318+ foreach ( var testCase in testCases )
319+ {
320+ var mapped = ResponseMapper . MapCompleteMultipartUploadResponse ( testCase ) ;
321+ Assert . IsNotNull ( mapped , "Response should always be mappable" ) ;
322+
323+ // Test null handling
324+ if ( testCase . Expiration == null )
325+ {
326+ Assert . IsNull ( mapped . Expiration , "Null Expiration should map to null" ) ;
327+ }
328+ }
329+ }
330+
220331 [ TestMethod ]
221332 [ TestCategory ( "S3" ) ]
222333 public void ValidateCompleteMultipartUploadResponseConversionCompleteness ( )
0 commit comments