@@ -60,8 +60,10 @@ public class NotificationUrlTest : BunqSdkTestBase
6060
6161 private void ExecuteNotificationUrlTest (
6262 string expectedJsonFileName ,
63- Type classNameExpected ,
64- string referencedObjectPropertyName
63+ Type classTypeExpected ,
64+ string referencedObjectPropertyName ,
65+ string subClassObjectPropertyName = null ,
66+ Type subClassTypeExpected = null
6567 ) {
6668 var jsonString = ReadJsonFromFile ( expectedJsonFileName ) ;
6769 var notificationUrl = BunqModel . CreateFromJsonString < NotificationUrl > ( jsonString ) ;
@@ -71,13 +73,19 @@ string referencedObjectPropertyName
7173
7274 var model = notificationUrl . Object . GetType ( ) . GetProperty ( referencedObjectPropertyName ) . GetValue (
7375 notificationUrl . Object ) ;
74- // Console.WriteLine(notificationUrl.Object);
7576 var referencedModel = notificationUrl . Object . GetReferencedObject ( ) ;
7677
7778 Assert . NotNull ( model ) ;
7879 Assert . NotNull ( referencedModel ) ;
79- Assert . IsType ( classNameExpected , referencedModel ) ;
80- Assert . Equal ( classNameExpected , referencedModel . GetType ( ) ) ;
80+ Assert . IsType ( classTypeExpected , referencedModel ) ;
81+ Assert . Equal ( classTypeExpected , referencedModel . GetType ( ) ) ;
82+
83+ if ( subClassObjectPropertyName == null || subClassTypeExpected == null ) return ;
84+ var subClass = referencedModel . GetType ( ) . GetProperty ( subClassObjectPropertyName ) . GetValue (
85+ referencedModel ) ;
86+
87+ Assert . NotNull ( subClass ) ;
88+ Assert . Equal ( subClassTypeExpected , subClass . GetType ( ) ) ;
8189 }
8290
8391 private static string ReadJsonFromFile ( string fileName )
@@ -117,7 +125,9 @@ public void TestChatMessageAnnouncementModel()
117125 ExecuteNotificationUrlTest (
118126 JSON_PATH_CHAT_MESSAGE_ANNOUNCEMENT_MODEL ,
119127 typeof ( ChatMessage ) ,
120- GET_CHAT_MESSAGE
128+ GET_CHAT_MESSAGE ,
129+ GET_CHAT_MESSAGE_ANNOUNCEMENT ,
130+ typeof ( ChatMessageAnnouncement )
121131 ) ;
122132 }
123133
@@ -147,7 +157,9 @@ public void TestMonetaryAccountBankModel()
147157 ExecuteNotificationUrlTest (
148158 JSON_PATH_MONETARY_ACCOUNT_BANK_MODEL ,
149159 typeof ( MonetaryAccount ) ,
150- GET_MONETARY_ACCOUNT
160+ GET_MONETARY_ACCOUNT ,
161+ GET_MONETARY_ACCOUNT_BANK ,
162+ typeof ( MonetaryAccountBank )
151163 ) ;
152164 }
153165
0 commit comments