File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
test/Microsoft.OpenApi.Tests/Models Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 66using FluentAssertions ;
77using Microsoft . OpenApi . Any ;
88using Microsoft . OpenApi . Extensions ;
9+ using Microsoft . OpenApi . Interfaces ;
910using Microsoft . OpenApi . Models ;
1011using Xunit ;
1112using Xunit . Abstractions ;
@@ -426,5 +427,21 @@ public void SerializeMediaTypeWithObjectExamplesAsV3JsonWorks()
426427 expected = expected . MakeLineBreaksEnvironmentNeutral ( ) ;
427428 actual . Should ( ) . Be ( expected ) ;
428429 }
430+
431+ [ Fact ]
432+ public void MediaTypeCopyConstructorWorks ( )
433+ {
434+ var clone = new OpenApiMediaType ( MediaTypeWithObjectExamples )
435+ {
436+ Example = 42 ,
437+ Examples = new Dictionary < string , OpenApiExample > ( ) ,
438+ Encoding = new Dictionary < string , OpenApiEncoding > ( ) ,
439+ Extensions = new Dictionary < string , IOpenApiExtension > ( )
440+ } ;
441+
442+ // Assert
443+ MediaTypeWithObjectExamples . Examples . Should ( ) . NotBeEquivalentTo ( clone . Examples ) ;
444+ MediaTypeWithObjectExamples . Example . Should ( ) . Be ( null ) ;
445+ }
429446 }
430447}
You can’t perform that action at this time.
0 commit comments