File tree 2 files changed +15
-0
lines changed
src/FluentAssertions.AspNetCore.Mvc
tests/FluentAssertions.AspNetCore.Mvc.Tests
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1
1
using FluentAssertions . Execution ;
2
2
using FluentAssertions . Primitives ;
3
3
using Microsoft . AspNetCore . Mvc ;
4
+ using Newtonsoft . Json ;
4
5
using System ;
5
6
using System . Diagnostics ;
6
7
@@ -27,6 +28,11 @@ public JsonResultAssertions(JsonResult subject) : base(subject)
27
28
28
29
#region Public Properties
29
30
31
+ /// <summary>
32
+ /// The serializer settings of the JsonResult.
33
+ /// </summary>
34
+ public JsonSerializerSettings SerializerSettings => JsonResultSubject . SerializerSettings ;
35
+
30
36
/// <summary>
31
37
/// The value on the JsonResult
32
38
/// </summary>
Original file line number Diff line number Diff line change 1
1
using FluentAssertions . Mvc . Tests . Helpers ;
2
2
using Microsoft . AspNetCore . Mvc ;
3
+ using Newtonsoft . Json ;
3
4
using System ;
4
5
using Xunit ;
5
6
@@ -90,5 +91,13 @@ public void ValueAs_Null_ShouldFail()
90
91
. WithMessage ( failureMessage ) ;
91
92
}
92
93
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
+ }
93
102
}
94
103
}
You can’t perform that action at this time.
0 commit comments