@@ -299,8 +299,11 @@ public void TestDictionaryDatabaseObjectSerializationDeserialization_WithDollarC
299299 Dictionary < string , DatabaseObject > dict = new ( ) { { "person" , _databaseTable } } ;
300300
301301 string serializedDict = JsonSerializer . Serialize ( dict , _options ) ;
302- Dictionary < string , DatabaseObject > deserializedDict = JsonSerializer . Deserialize < Dictionary < string , DatabaseObject > > ( serializedDict , _options ) ! ;
302+ // Assert that the serialized JSON contains the escaped dollar sign in column name
303+ Assert . IsTrue ( serializedDict . Contains ( "DAB_ESCAPE$FirstName" ) ,
304+ "Serialized JSON should contain the dollar-prefixed column name in SourceDefinition's Columns." ) ;
303305
306+ Dictionary < string , DatabaseObject > deserializedDict = JsonSerializer . Deserialize < Dictionary < string , DatabaseObject > > ( serializedDict , _options ) ! ;
304307 DatabaseTable deserializedDatabaseTable = ( DatabaseTable ) deserializedDict [ "person" ] ;
305308
306309 Assert . AreEqual ( deserializedDatabaseTable . SourceType , _databaseTable . SourceType ) ;
@@ -322,14 +325,22 @@ public void TestDatabaseViewSerializationDeserialization_WithDollarColumn()
322325
323326 TestTypeNameChanges ( _databaseView , "DatabaseView" ) ;
324327
328+ Dictionary < string , DatabaseObject > dict = new ( ) ;
329+ dict . Add ( "person" , _databaseView ) ;
330+
325331 // Test to catch if there is change in number of properties/fields
326332 // Note: On Addition of property make sure it is added in following object creation _databaseView and include in serialization
327333 // and deserialization test.
328334 int fields = typeof ( DatabaseView ) . GetProperties ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) . Length ;
329335 Assert . AreEqual ( fields , 6 ) ;
330336
331- string serializedDatabaseView = JsonSerializer . Serialize ( _databaseView , _options ) ;
332- DatabaseView deserializedDatabaseView = JsonSerializer . Deserialize < DatabaseView > ( serializedDatabaseView , _options ) ! ;
337+ string serializedDatabaseView = JsonSerializer . Serialize ( dict , _options ) ;
338+ // Assert that the serialized JSON contains the escaped dollar sign in column name
339+ Assert . IsTrue ( serializedDatabaseView . Contains ( "DAB_ESCAPE$FirstName" ) ,
340+ "Serialized JSON should contain the dollar-prefixed column name in SourceDefinition's Columns." ) ;
341+ Dictionary < string , DatabaseObject > deserializedDict = JsonSerializer . Deserialize < Dictionary < string , DatabaseObject > > ( serializedDatabaseView , _options ) ! ;
342+
343+ DatabaseView deserializedDatabaseView = ( DatabaseView ) deserializedDict [ "person" ] ;
333344
334345 Assert . AreEqual ( deserializedDatabaseView . SourceType , _databaseView . SourceType ) ;
335346 deserializedDatabaseView . Equals ( _databaseView ) ;
@@ -349,14 +360,21 @@ public void TestDatabaseStoredProcedureSerializationDeserialization_WithDollarCo
349360
350361 TestTypeNameChanges ( _databaseStoredProcedure , "DatabaseStoredProcedure" ) ;
351362
363+ Dictionary < string , DatabaseObject > dict = new ( ) ;
364+ dict . Add ( "person" , _databaseStoredProcedure ) ;
365+
352366 // Test to catch if there is change in number of properties/fields
353367 // Note: On Addition of property make sure it is added in following object creation _databaseStoredProcedure and include in serialization
354368 // and deserialization test.
355369 int fields = typeof ( DatabaseStoredProcedure ) . GetProperties ( BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ) . Length ;
356370 Assert . AreEqual ( fields , 6 ) ;
357371
358- string serializedDatabaseSP = JsonSerializer . Serialize ( _databaseStoredProcedure , _options ) ;
359- DatabaseStoredProcedure deserializedDatabaseSP = JsonSerializer . Deserialize < DatabaseStoredProcedure > ( serializedDatabaseSP , _options ) ! ;
372+ string serializedDatabaseSP = JsonSerializer . Serialize ( dict , _options ) ;
373+ // Assert that the serialized JSON contains the escaped dollar sign in column name
374+ Assert . IsTrue ( serializedDatabaseSP . Contains ( "DAB_ESCAPE$FirstName" ) ,
375+ "Serialized JSON should contain the dollar-prefixed column name in SourceDefinition's Columns." ) ;
376+ Dictionary < string , DatabaseObject > deserializedDict = JsonSerializer . Deserialize < Dictionary < string , DatabaseObject > > ( serializedDatabaseSP , _options ) ! ;
377+ DatabaseStoredProcedure deserializedDatabaseSP = ( DatabaseStoredProcedure ) deserializedDict [ "person" ] ;
360378
361379 Assert . AreEqual ( deserializedDatabaseSP . SourceType , _databaseStoredProcedure . SourceType ) ;
362380 deserializedDatabaseSP . Equals ( _databaseStoredProcedure ) ;
0 commit comments