@@ -245,6 +245,117 @@ public void ValidateTransferUtilityUploadResponseDefinitionCompleteness()
245245 "TransferUtilityUploadResponse" ) ;
246246 }
247247
248+ [ TestMethod ]
249+ [ TestCategory ( "S3" ) ]
250+ public void MapCompleteMultipartUploadResponse_AllMappedProperties_WorkCorrectly ( )
251+ {
252+ // Get the expected mappings from JSON
253+ var completeMultipartMappings = _mappingJson . RootElement
254+ . GetProperty ( "Conversion" )
255+ . GetProperty ( "CompleteMultipartResponse" )
256+ . GetProperty ( "UploadResponse" )
257+ . EnumerateArray ( )
258+ . Select ( prop => prop . GetString ( ) )
259+ . ToList ( ) ;
260+
261+ // Create source object with dynamically generated test data
262+ var sourceResponse = new CompleteMultipartUploadResponse ( ) ;
263+ var sourceType = typeof ( CompleteMultipartUploadResponse ) ;
264+ var testDataValues = new Dictionary < string , object > ( ) ;
265+
266+ // Generate test data for each mapped property
267+ foreach ( var propertyName in completeMultipartMappings )
268+ {
269+ // Resolve alias to actual property name
270+ var resolvedPropertyName = ResolvePropertyName ( propertyName ) ;
271+ var sourceProperty = sourceType . GetProperty ( resolvedPropertyName ) ;
272+ if ( sourceProperty ? . CanWrite == true )
273+ {
274+ var testValue = GenerateTestValue ( sourceProperty . PropertyType , propertyName ) ;
275+ sourceProperty . SetValue ( sourceResponse , testValue ) ;
276+ testDataValues [ propertyName ] = testValue ;
277+ }
278+ }
279+
280+ // Add inherited properties for comprehensive testing
281+ sourceResponse . HttpStatusCode = HttpStatusCode . OK ;
282+ sourceResponse . ContentLength = 2048 ;
283+
284+ // Map the response
285+ var mappedResponse = ResponseMapper . MapCompleteMultipartUploadResponse ( sourceResponse ) ;
286+ Assert . IsNotNull ( mappedResponse , "Mapped response should not be null" ) ;
287+
288+ // Verify all mapped properties using reflection
289+ var targetType = typeof ( TransferUtilityUploadResponse ) ;
290+ var failedAssertions = new List < string > ( ) ;
291+
292+ foreach ( var propertyName in completeMultipartMappings )
293+ {
294+ // Resolve alias to actual property name for reflection lookups
295+ var resolvedPropertyName = ResolvePropertyName ( propertyName ) ;
296+ var sourceProperty = sourceType . GetProperty ( resolvedPropertyName ) ;
297+ var targetProperty = targetType . GetProperty ( resolvedPropertyName ) ;
298+
299+ if ( sourceProperty == null )
300+ {
301+ failedAssertions . Add ( $ "Source property '{ propertyName } ' (resolved to: { resolvedPropertyName } ) not found in CompleteMultipartUploadResponse") ;
302+ continue ;
303+ }
304+
305+ if ( targetProperty == null )
306+ {
307+ failedAssertions . Add ( $ "Target property '{ propertyName } ' (resolved to: { resolvedPropertyName } ) not found in TransferUtilityUploadResponse") ;
308+ continue ;
309+ }
310+
311+ var sourceValue = sourceProperty . GetValue ( sourceResponse ) ;
312+ var targetValue = targetProperty . GetValue ( mappedResponse ) ;
313+
314+ // Special handling for complex object comparisons
315+ if ( ! AreValuesEqual ( sourceValue , targetValue ) )
316+ {
317+ failedAssertions . Add ( $ "{ propertyName } : Expected '{ sourceValue ?? "null" } ', got '{ targetValue ?? "null" } '") ;
318+ }
319+ }
320+
321+ // Test inherited properties
322+ Assert . AreEqual ( sourceResponse . HttpStatusCode , mappedResponse . HttpStatusCode , "HttpStatusCode should match" ) ;
323+ Assert . AreEqual ( sourceResponse . ContentLength , mappedResponse . ContentLength , "ContentLength should match" ) ;
324+
325+ // Report any failures
326+ if ( failedAssertions . Any ( ) )
327+ {
328+ Assert . Fail ( $ "Property mapping failures:\n { string . Join ( "\n " , failedAssertions ) } ") ;
329+ }
330+ }
331+
332+ [ TestMethod ]
333+ [ TestCategory ( "S3" ) ]
334+ public void MapCompleteMultipartUploadResponse_NullValues_HandledCorrectly ( )
335+ {
336+ // Test null handling scenarios
337+ var testCases = new [ ]
338+ {
339+ // Test null Expiration
340+ new CompleteMultipartUploadResponse { Expiration = null } ,
341+
342+ // Test null enum conversions
343+ new CompleteMultipartUploadResponse { ChecksumType = null , RequestCharged = null , ServerSideEncryption = null }
344+ } ;
345+
346+ foreach ( var testCase in testCases )
347+ {
348+ var mapped = ResponseMapper . MapCompleteMultipartUploadResponse ( testCase ) ;
349+ Assert . IsNotNull ( mapped , "Response should always be mappable" ) ;
350+
351+ // Test null handling
352+ if ( testCase . Expiration == null )
353+ {
354+ Assert . IsNull ( mapped . Expiration , "Null Expiration should map to null" ) ;
355+ }
356+ }
357+ }
358+
248359 [ TestMethod ]
249360 [ TestCategory ( "S3" ) ]
250361 public void ValidateCompleteMultipartUploadResponseConversionCompleteness ( )
0 commit comments