@@ -12,6 +12,7 @@ namespace FluentAssertions
1212 using FluentAssertions . Collections ;
1313 using FluentAssertions . Common ;
1414 using FluentAssertions . Equivalency ;
15+ using FluentAssertions . Numeric ;
1516 using FluentAssertions . Primitives ;
1617 using PosInformatique . FluentAssertions . Json ;
1718
@@ -105,7 +106,7 @@ public static void BeJsonDeserializableInto<T>(this ObjectAssertions assertions,
105106 /// </summary>
106107 /// <typeparam name="TElement">Type of the element of the collection to check the JSON deserialization.</typeparam>
107108 /// <typeparam name="T">Type of the object to deserialize from JSON.</typeparam>
108- /// <param name="assertions"><see cref="ObjectAssertions "/> which contains the JSON collection subject to deserialize.</param>
109+ /// <param name="assertions"><see cref="GenericCollectionAssertions{T} "/> which contains the JSON collection subject to deserialize.</param>
109110 /// <param name="expectedObject">Expected collection deserialized expected.</param>
110111 /// <param name="options"><see cref="JsonSerializerOptions"/> to use to assert the deserialization. If not specified
111112 /// the default <see cref="IFluentAssertionsJsonConfiguration.JsonSerializerOptions"/> of the <see cref="FluentAssertionsJson.Configuration"/>
@@ -115,6 +116,49 @@ public static void BeJsonDeserializableInto<TElement, T>(this GenericCollectionA
115116 BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , GetSerializerOptions ( options ) ) ;
116117 }
117118
119+ /// <summary>
120+ /// Check if the JSON subject string collection is deserializable into the specified <paramref name="expectedObject"/> argument.
121+ /// </summary>
122+ /// <typeparam name="T">Type of the object to deserialize from JSON.</typeparam>
123+ /// <param name="assertions"><see cref="StringCollectionAssertions"/> which contains the JSON string collection subject to deserialize.</param>
124+ /// <param name="expectedObject">Expected string collection deserialized expected.</param>
125+ /// <param name="options"><see cref="JsonSerializerOptions"/> to use to assert the deserialization. If not specified
126+ /// the default <see cref="IFluentAssertionsJsonConfiguration.JsonSerializerOptions"/> of the <see cref="FluentAssertionsJson.Configuration"/>
127+ /// will be used.</param>
128+ public static void BeJsonDeserializableInto < T > ( this StringCollectionAssertions assertions , T expectedObject , JsonSerializerOptions ? options = null )
129+ {
130+ BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , GetSerializerOptions ( options ) ) ;
131+ }
132+
133+ /// <summary>
134+ /// Check if the JSON subject numeric is deserializable into the specified <paramref name="expectedObject"/> argument.
135+ /// </summary>
136+ /// <typeparam name="T">Type of the object to deserialize from JSON.</typeparam>
137+ /// <param name="assertions"><see cref="NumericAssertions{T}"/> which contains the JSON numeric subject to deserialize.</param>
138+ /// <param name="expectedObject">Expected numeric value deserialized expected.</param>
139+ /// <param name="options"><see cref="JsonSerializerOptions"/> to use to assert the deserialization. If not specified
140+ /// the default <see cref="IFluentAssertionsJsonConfiguration.JsonSerializerOptions"/> of the <see cref="FluentAssertionsJson.Configuration"/>
141+ /// will be used.</param>
142+ public static void BeJsonDeserializableInto < T > ( this NumericAssertions < T > assertions , T expectedObject , JsonSerializerOptions ? options = null )
143+ where T : struct , IComparable < T >
144+ {
145+ BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , GetSerializerOptions ( options ) ) ;
146+ }
147+
148+ /// <summary>
149+ /// Check if the JSON subject string is deserializable into the specified <paramref name="expectedObject"/> argument.
150+ /// </summary>
151+ /// <typeparam name="T">Type of the object to deserialize from JSON.</typeparam>
152+ /// <param name="assertions"><see cref="StringAssertions"/> which contains the JSON string subject to deserialize.</param>
153+ /// <param name="expectedObject">Expected string value deserialized expected.</param>
154+ /// <param name="options"><see cref="JsonSerializerOptions"/> to use to assert the deserialization. If not specified
155+ /// the default <see cref="IFluentAssertionsJsonConfiguration.JsonSerializerOptions"/> of the <see cref="FluentAssertionsJson.Configuration"/>
156+ /// will be used.</param>
157+ public static void BeJsonDeserializableInto < T > ( this StringAssertions assertions , T expectedObject , JsonSerializerOptions ? options = null )
158+ {
159+ BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , GetSerializerOptions ( options ) ) ;
160+ }
161+
118162 /// <summary>
119163 /// Check if the JSON subject object is deserializable into the specified <paramref name="expectedObject"/> argument.
120164 /// </summary>
@@ -150,6 +194,58 @@ public static void BeJsonDeserializableInto<TElement, T>(this GenericCollectionA
150194 BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , optionsCopy ) ;
151195 }
152196
197+ /// <summary>
198+ /// Check if the JSON subject string collection is deserializable into the specified <paramref name="expectedObject"/> argument.
199+ /// </summary>
200+ /// <typeparam name="T">Type of the object to deserialize from JSON.</typeparam>
201+ /// <param name="assertions"><see cref="ObjectAssertions"/> which contains the JSON string collection subject to deserialize.</param>
202+ /// <param name="expectedObject">Expected string collection deserialized expected.</param>
203+ /// <param name="configureOptions">Allows to change the default <see cref="IFluentAssertionsJsonConfiguration.JsonSerializerOptions"/>
204+ /// of the <see cref="FluentAssertionsJson.Configuration"/> used to assert the deserialization.</param>
205+ public static void BeJsonDeserializableInto < T > ( this StringCollectionAssertions assertions , T expectedObject , Action < JsonSerializerOptions > configureOptions )
206+ {
207+ var optionsCopy = new JsonSerializerOptions ( FluentAssertionsJson . Configuration . JsonSerializerOptions ) ;
208+
209+ configureOptions ( optionsCopy ) ;
210+
211+ BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , optionsCopy ) ;
212+ }
213+
214+ /// <summary>
215+ /// Check if the JSON subject numeric is deserializable into the specified <paramref name="expectedObject"/> argument.
216+ /// </summary>
217+ /// <typeparam name="T">Type of the numeric value to deserialize from JSON.</typeparam>
218+ /// <param name="assertions"><see cref="ObjectAssertions"/> which contains the JSON numeric subject to deserialize.</param>
219+ /// <param name="expectedObject">Expected numeric value deserialized expected.</param>
220+ /// <param name="configureOptions">Allows to change the default <see cref="IFluentAssertionsJsonConfiguration.JsonSerializerOptions"/>
221+ /// of the <see cref="FluentAssertionsJson.Configuration"/> used to assert the deserialization.</param>
222+ public static void BeJsonDeserializableInto < T > ( this NumericAssertions < T > assertions , T expectedObject , Action < JsonSerializerOptions > configureOptions )
223+ where T : struct , IComparable < T >
224+ {
225+ var optionsCopy = new JsonSerializerOptions ( FluentAssertionsJson . Configuration . JsonSerializerOptions ) ;
226+
227+ configureOptions ( optionsCopy ) ;
228+
229+ BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , optionsCopy ) ;
230+ }
231+
232+ /// <summary>
233+ /// Check if the JSON subject string is deserializable into the specified <paramref name="expectedObject"/> argument.
234+ /// </summary>
235+ /// <typeparam name="T">Type of the string value to deserialize from JSON.</typeparam>
236+ /// <param name="assertions"><see cref="StringAssertions"/> which contains the JSON string subject to deserialize.</param>
237+ /// <param name="expectedObject">Expected string value deserialized expected.</param>
238+ /// <param name="configureOptions">Allows to change the default <see cref="IFluentAssertionsJsonConfiguration.JsonSerializerOptions"/>
239+ /// of the <see cref="FluentAssertionsJson.Configuration"/> used to assert the deserialization.</param>
240+ public static void BeJsonDeserializableInto < T > ( this StringAssertions assertions , T expectedObject , Action < JsonSerializerOptions > configureOptions )
241+ {
242+ var optionsCopy = new JsonSerializerOptions ( FluentAssertionsJson . Configuration . JsonSerializerOptions ) ;
243+
244+ configureOptions ( optionsCopy ) ;
245+
246+ BeJsonDeserializableIntoCore ( assertions . Subject , expectedObject , optionsCopy ) ;
247+ }
248+
153249 private static void BeJsonSerializableIntoCore < TBase > ( ObjectAssertions assertions , object ? expectedJson , JsonSerializerOptions options )
154250 {
155251 if ( assertions . Subject is not null && assertions . Subject is not TBase )
0 commit comments