@@ -534,6 +534,59 @@ MyWebApi
534534 .ContainingNoModelStateErrorFor (m => m .NonRequiredString );
535535```
536536
537+ #### JSON result
538+ ``` c#
539+ // tests whether the action returns JSON
540+ MyWebApi
541+ .Controller <WebApiController >()
542+ .Calling (c => c .SomeAction ())
543+ .ShouldReturn ()
544+ .Json ();
545+
546+ // tests whether the action returns JSON
547+ // with default encoding and settings
548+ MyWebApi
549+ .Controller <WebApiController >()
550+ .Calling (c => c .SomeAction ())
551+ .ShouldReturn ()
552+ .Json ()
553+ .WithDefaultEncoding ()
554+ .AndAlso () // AndAlso is not necessary
555+ .WithDefaulJsonSerializerSettings ();
556+
557+ // tests whether the action returns JSON
558+ // with expected encoding
559+ MyWebApi
560+ .Controller <WebApiController >()
561+ .Calling (c => c .SomeAction ())
562+ .ShouldReturn ()
563+ .Json ()
564+ .WithEncoding (Encoding .ASCII );
565+
566+ // tests whether the action returns JSON
567+ // with expected serializer settings
568+ MyWebApi
569+ .Controller <WebApiController >()
570+ .Calling (c => c .SomeAction ())
571+ .ShouldReturn ()
572+ .Json ()
573+ .WithJsonSerializerSettings (new MyCustomSerializerSettings ());
574+
575+ // tests whether the action returns JSON
576+ // with expected serializer settings constructed by builder
577+ MyWebApi
578+ .Controller <WebApiController >()
579+ .Calling (c => c .JsonWithSettingsAction ())
580+ .ShouldReturn ()
581+ .Json ()
582+ .WithJsonSerializerSettings (s => s
583+ .WithFormatting (Formatting .Indented )
584+ .AndAlso () // AndAlso is not necessary
585+ .WithMaxDepth (2 )
586+ .AndAlso ()
587+ .WithConstructorHandling (ConstructorHandling .Default ));
588+ ```
589+
537590#### StatusCode result
538591
539592``` c#
0 commit comments