Skip to content

Commit 60f2e9d

Browse files
author
Sam Segers
committed
Fix example documentation in JTokenAssertions
1 parent 7203f29 commit 60f2e9d

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

Src/FluentAssertions.Json/JTokenAssertions.cs

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,17 @@ public AndConstraint<JTokenAssertions> HaveCount(int expected, string because =
437437
/// <example>
438438
/// This example asserts the values of multiple properties of a child object within a JSON document.
439439
/// <code>
440-
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'Noone' } }");
441-
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'Noone' } }"));
440+
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'None' } }");
441+
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'None' } }"));
442442
/// </code>
443443
/// </example>
444-
/// <example>This example asserts that a <see cref="JArray"/> within a <see cref="JObject"/> has at least one element with at least the given properties</example>
444+
/// <example>
445+
/// This example asserts that a <see cref="JArray"/> within a <see cref="JObject"/> has at least one element with at least the given properties
445446
/// <code>
446447
/// var json = JToken.Parse("{ id: 1, items: [ { id: 2, type: 'my-type', name: 'Alpha' }, { id: 3, type: 'other-type', name: 'Bravo' } ] }");
447448
/// json.Should().ContainSubtree(JToken.Parse("{ items: [ { type: 'my-type', name: 'Alpha' } ] }"));
448449
/// </code>
450+
/// </example>
449451
public AndConstraint<JTokenAssertions> ContainSubtree(string subtree, string because = "", params object[] becauseArgs)
450452
{
451453
JToken subtreeToken;
@@ -482,15 +484,17 @@ public AndConstraint<JTokenAssertions> ContainSubtree(string subtree, string bec
482484
/// <example>
483485
/// This example asserts the values of multiple properties of a child object within a JSON document.
484486
/// <code>
485-
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'Noone' } }");
486-
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'Noone' } }"));
487+
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'None' } }");
488+
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'None' } }"));
487489
/// </code>
488490
/// </example>
489-
/// <example>This example asserts that a <see cref="JArray"/> within a <see cref="JObject"/> has at least one element with at least the given properties</example>
491+
/// <example>
492+
/// This example asserts that a <see cref="JArray"/> within a <see cref="JObject"/> has at least one element with at least the given properties
490493
/// <code>
491494
/// var json = JToken.Parse("{ id: 1, items: [ { id: 2, type: 'my-type', name: 'Alpha' }, { id: 3, type: 'other-type', name: 'Bravo' } ] }");
492495
/// json.Should().ContainSubtree(JToken.Parse("{ items: [ { type: 'my-type', name: 'Alpha' } ] }"));
493496
/// </code>
497+
/// </example>
494498
public AndConstraint<JTokenAssertions> ContainSubtree(JToken subtree, string because = "", params object[] becauseArgs)
495499
{
496500
return BeEquivalentTo(subtree, true, options => options, because, becauseArgs);
@@ -511,18 +515,6 @@ public AndConstraint<JTokenAssertions> ContainSubtree(JToken subtree, string bec
511515
/// <remarks>Use this method to match the current <see cref="JToken"/> against an arbitrary subtree,
512516
/// permitting it to contain any additional properties or elements. This way we can test multiple properties on a <see cref="JObject"/> at once,
513517
/// or test if a <see cref="JArray"/> contains any items that match a set of properties, assert that a JSON document has a given shape, etc. </remarks>
514-
/// <example>
515-
/// This example asserts the values of multiple properties of a child object within a JSON document.
516-
/// <code>
517-
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'Noone' } }");
518-
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'Noone' } }"));
519-
/// </code>
520-
/// </example>
521-
/// <example>This example asserts that a <see cref="JArray"/> within a <see cref="JObject"/> has at least one element with at least the given properties</example>
522-
/// <code>
523-
/// var json = JToken.Parse("{ id: 1, items: [ { id: 2, type: 'my-type', name: 'Alpha' }, { id: 3, type: 'other-type', name: 'Bravo' } ] }");
524-
/// json.Should().ContainSubtree(JToken.Parse("{ items: [ { type: 'my-type', name: 'Alpha' } ] }"));
525-
/// </code>
526518
public AndConstraint<JTokenAssertions> ContainSubtree(JToken subtree,
527519
Func<IJsonAssertionOptions<object>, IJsonAssertionOptions<object>> config,
528520
string because = "",

0 commit comments

Comments
 (0)