File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/MessagePack.UnityClient/Assets/Scripts/Tests/ShareTests Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ public void DeserializerSetsMissingPropertiesToDefaultValue_OrdinalKey()
8484 Assert . Null ( instance . Prop2 ) ;
8585 }
8686
87+ [ Fact ]
88+ public void CtorParameterAndPropertySetterExists ( )
89+ {
90+ var m1 = new ClassWithPropertySetterAndDummyCtor ( 999 ) { MyProperty = 100 } ;
91+ byte [ ] bin = MessagePackSerializer . Serialize ( m1 ) ;
92+ var m2 = MessagePackSerializer . Deserialize < ClassWithPropertySetterAndDummyCtor > ( bin ) ;
93+
94+ // In this version of the deserializer, we expect the property setter to be invoked
95+ // and reaffirm the value already passed to the constructor.
96+ Assert . Equal ( m1 . MyProperty , m2 . MyProperty ) ;
97+ }
98+
8799 /// <summary>
88100 /// Verifies that virtual and overridden properties do not cause the dynamic resolver to malfunction.
89101 /// </summary>
@@ -357,6 +369,17 @@ public class DerivedClass : BaseClass
357369 [ DataMember ]
358370 public string Name { get ; set ; }
359371 }
372+
373+ [ MessagePackObject ( true ) ]
374+ public class ClassWithPropertySetterAndDummyCtor
375+ {
376+ public int MyProperty { get ; set ; }
377+
378+ public ClassWithPropertySetterAndDummyCtor ( int myProperty )
379+ {
380+ // This constructor intentionally left blank.
381+ }
382+ }
360383 }
361384}
362385
You can’t perform that action at this time.
0 commit comments