Skip to content

Commit 45e9db1

Browse files
author
sam.segers
committed
fix example documentation in JTokenAssertions
1 parent 50c002d commit 45e9db1

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Src/FluentAssertions.Json/JTokenAssertions.cs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public AndWhichConstraint<JTokenAssertions, JToken> NotHaveElement(string unexpe
361361
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
362362
/// </param>
363363
/// <param name="becauseArgs">
364-
/// Zero or more objects to format using the placeholders in <see cref="because" />.
364+
/// Zero or more objects to format using the placeholders in <paramref name="because"/>.
365365
/// </param>
366366
public AndWhichConstraint<JTokenAssertions, JToken> ContainSingleItem(string because = "", params object[] becauseArgs)
367367
{
@@ -383,7 +383,7 @@ public AndWhichConstraint<JTokenAssertions, JToken> ContainSingleItem(string bec
383383
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
384384
/// </param>
385385
/// <param name="becauseArgs">
386-
/// Zero or more objects to format using the placeholders in <see cref="because" />.
386+
/// Zero or more objects to format using the placeholders in <paramref name="because"/>.
387387
/// </param>
388388
public AndConstraint<JTokenAssertions> HaveCount(int expected, string because = "", params object[] becauseArgs)
389389
{
@@ -405,23 +405,25 @@ public AndConstraint<JTokenAssertions> HaveCount(int expected, string because =
405405
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
406406
/// </param>
407407
/// <param name="becauseArgs">
408-
/// Zero or more objects to format using the placeholders in <see cref="because" />.
408+
/// Zero or more objects to format using the placeholders in <paramref name="because"/>.
409409
/// </param>
410410
/// <remarks>Use this method to match the current <see cref="JToken"/> against an arbitrary subtree,
411411
/// permitting it to contain any additional properties or elements. This way we can test multiple properties on a <see cref="JObject"/> at once,
412412
/// 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>
413413
/// <example>
414414
/// This example asserts the values of multiple properties of a child object within a JSON document.
415415
/// <code>
416-
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'Noone' } }");
417-
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'Noone' } }"));
416+
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'John' } }");
417+
/// json.Should().ContainSubtree("{ success: true, data: { type: 'my-type', name: 'John' } }");
418418
/// </code>
419419
/// </example>
420-
/// <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>
420+
/// <example>
421+
/// This example asserts that a <see cref="JArray"/> within a <see cref="JObject"/> has at least one element with at least the given properties
421422
/// <code>
422423
/// var json = JToken.Parse("{ id: 1, items: [ { id: 2, type: 'my-type', name: 'Alpha' }, { id: 3, type: 'other-type', name: 'Bravo' } ] }");
423-
/// json.Should().ContainSubtree(JToken.Parse("{ items: [ { type: 'my-type', name: 'Alpha' } ] }"));
424+
/// json.Should().ContainSubtree("{ items: [ { type: 'my-type', name: 'Alpha' } ] }");
424425
/// </code>
426+
/// </example>
425427
public AndConstraint<JTokenAssertions> ContainSubtree(string subtree, string because = "", params object[] becauseArgs)
426428
{
427429
JToken subtreeToken = Parse(subtree, nameof(subtree));
@@ -438,23 +440,25 @@ public AndConstraint<JTokenAssertions> ContainSubtree(string subtree, string bec
438440
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
439441
/// </param>
440442
/// <param name="becauseArgs">
441-
/// Zero or more objects to format using the placeholders in <see cref="because" />.
443+
/// Zero or more objects to format using the placeholders in <paramref name="because"/>.
442444
/// </param>
443445
/// <remarks>Use this method to match the current <see cref="JToken"/> against an arbitrary subtree,
444446
/// permitting it to contain any additional properties or elements. This way we can test multiple properties on a <see cref="JObject"/> at once,
445447
/// 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>
446448
/// <example>
447449
/// This example asserts the values of multiple properties of a child object within a JSON document.
448450
/// <code>
449-
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'Noone' } }");
450-
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'Noone' } }"));
451+
/// var json = JToken.Parse("{ success: true, data: { id: 123, type: 'my-type', name: 'John' } }");
452+
/// json.Should().ContainSubtree(JToken.Parse("{ success: true, data: { type: 'my-type', name: 'John' } }"));
451453
/// </code>
452454
/// </example>
453-
/// <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>
455+
/// <example>
456+
/// This example asserts that a <see cref="JArray"/> within a <see cref="JObject"/> has at least one element with at least the given properties
454457
/// <code>
455458
/// var json = JToken.Parse("{ id: 1, items: [ { id: 2, type: 'my-type', name: 'Alpha' }, { id: 3, type: 'other-type', name: 'Bravo' } ] }");
456459
/// json.Should().ContainSubtree(JToken.Parse("{ items: [ { type: 'my-type', name: 'Alpha' } ] }"));
457460
/// </code>
461+
/// </example>
458462
public AndConstraint<JTokenAssertions> ContainSubtree(JToken subtree, string because = "", params object[] becauseArgs)
459463
{
460464
return BeEquivalentTo(subtree, true, options => options, because, becauseArgs);

0 commit comments

Comments
 (0)