@@ -79,7 +79,7 @@ public void TestObjectShouldSerializeDateTimeOffsetForProperty()
7979 [ TestMethod ]
8080 public void TestObjectShouldDeserializeCustomProperties ( )
8181 {
82- var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 1 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.Guid\" },\" Value\" :\" 02048dfd-3da7-475d-a011-8dd1121855ec\" },{\" Key\" :{\" Id\" :\" 2\" ,\" Label\" :\" label2\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.Int32\" },\" Value\" :29}]}" ;
82+ var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 13 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.Guid\" },\" Value\" :\" 02048dfd-3da7-475d-a011-8dd1121855ec\" },{\" Key\" :{\" Id\" :\" 2\" ,\" Label\" :\" label2\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.Int32\" },\" Value\" :29}]}" ;
8383
8484 var test = Deserialize < TestableTestObject > ( json ) ;
8585
@@ -92,7 +92,7 @@ public void TestObjectShouldDeserializeCustomProperties()
9292 [ TestMethod ]
9393 public void TestObjectShouldDeserializeNullValueForProperty ( )
9494 {
95- var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 1 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.String\" },\" Value\" :null}]}" ;
95+ var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 14 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.String\" },\" Value\" :null}]}" ;
9696
9797 var test = Deserialize < TestableTestObject > ( json ) ;
9898
@@ -104,7 +104,7 @@ public void TestObjectShouldDeserializeNullValueForProperty()
104104 [ TestMethod ]
105105 public void TestObjectShouldDeserializeStringArrayValueForProperty ( )
106106 {
107- var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 1 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.String[]\" },\" Value\" :[\" val1\" , \" val2\" ]}]}" ;
107+ var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 15 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.String[]\" },\" Value\" :[\" val1\" , \" val2\" ]}]}" ;
108108
109109 var test = Deserialize < TestableTestObject > ( json ) ;
110110
@@ -116,7 +116,7 @@ public void TestObjectShouldDeserializeStringArrayValueForProperty()
116116 [ TestMethod ]
117117 public void TestObjectShouldDeserializeDatetimeOffset ( )
118118 {
119- var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 11 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.DateTimeOffset\" },\" Value\" :\" 9999-12-31T23:59:59.9999999+00:00\" }]}" ;
119+ var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 16 \" ,\" Label\" :\" label1\" ,\" Category\" :\" \" ,\" Description\" :\" \" ,\" Attributes\" :0,\" ValueType\" :\" System.DateTimeOffset\" },\" Value\" :\" 9999-12-31T23:59:59.9999999+00:00\" }]}" ;
120120
121121 var test = Deserialize < TestableTestObject > ( json ) ;
122122
@@ -125,6 +125,24 @@ public void TestObjectShouldDeserializeDatetimeOffset()
125125 Assert . AreEqual ( DateTimeOffset . MaxValue , test . GetPropertyValue ( properties [ 0 ] ) ) ;
126126 }
127127
128+ [ TestMethod ]
129+ public void TestObjectShouldAddPropertyToTestPropertyStoreOnDeserialize ( )
130+ {
131+ var json = "{\" Properties\" :[{\" Key\" :{\" Id\" :\" 17\" ,\" Label\" :\" label1\" ,\" Category\" :\" c\" ,\" Description\" :\" d\" ,\" Attributes\" :0,\" ValueType\" :\" System.String\" },\" Value\" :\" DummyValue\" }]}" ;
132+
133+ var test = Deserialize < TestableTestObject > ( json ) ;
134+
135+ var property = TestProperty . Find ( "17" ) ;
136+ Assert . IsNotNull ( property ) ;
137+ Assert . AreEqual ( "17" , property . Id ) ;
138+ Assert . AreEqual ( "label1" , property . Label ) ;
139+ Assert . AreEqual ( "c" , property . Category ) ;
140+ Assert . AreEqual ( "d" , property . Description ) ;
141+ Assert . AreEqual ( typeof ( string ) , property . GetValueType ( ) ) ;
142+ Assert . AreEqual ( TestPropertyAttributes . None , property . Attributes ) ;
143+ Assert . AreEqual ( "DummyValue" , test . GetPropertyValue ( property ) ) ;
144+ }
145+
128146 private static string Serialize < T > ( T data )
129147 {
130148 return JsonDataSerializer . Instance . Serialize ( data ) ;
0 commit comments