File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
src/FluentAssertions.AspNetCore.Mvc
tests/FluentAssertions.AspNetCore.Mvc.Tests Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 11using FluentAssertions . Execution ;
22using FluentAssertions . Primitives ;
33using Microsoft . AspNetCore . Mvc ;
4+ using Newtonsoft . Json ;
45using System ;
56using System . Diagnostics ;
67
@@ -27,6 +28,11 @@ public JsonResultAssertions(JsonResult subject) : base(subject)
2728
2829 #region Public Properties
2930
31+ /// <summary>
32+ /// The serializer settings of the JsonResult.
33+ /// </summary>
34+ public JsonSerializerSettings SerializerSettings => JsonResultSubject . SerializerSettings ;
35+
3036 /// <summary>
3137 /// The value on the JsonResult
3238 /// </summary>
Original file line number Diff line number Diff line change 11using FluentAssertions . Mvc . Tests . Helpers ;
22using Microsoft . AspNetCore . Mvc ;
3+ using Newtonsoft . Json ;
34using System ;
45using Xunit ;
56
@@ -90,5 +91,13 @@ public void ValueAs_Null_ShouldFail()
9091 . WithMessage ( failureMessage ) ;
9192 }
9293
94+ [ Fact ]
95+ public void SerializerSettings_GivenExpectedValue_ShouldPass ( )
96+ {
97+ var expectedValue = new JsonSerializerSettings ( ) ;
98+ var result = new JsonResult ( "value" , expectedValue ) ;
99+
100+ result . Should ( ) . BeJsonResult ( ) . SerializerSettings . Should ( ) . BeSameAs ( expectedValue ) ;
101+ }
93102 }
94103}
You can’t perform that action at this time.
0 commit comments