Skip to content

Commit 57519f2

Browse files
committed
Add comments.
1 parent cf8e22c commit 57519f2

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

src/FluentAssertions.AspNetCore.Mvc/ActionResultAssertions.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,24 @@ public EmptyResult BeEmptyResult(string reason, params object[] reasonArgs)
8686
return Subject as EmptyResult;
8787
}
8888

89+
/// <summary>
90+
/// Asserts that the subject is an <see cref="JsonResult"/>.
91+
/// </summary>
8992
public JsonResultAssertions BeJsonResult()
9093
{
9194
return BeJsonResult(string.Empty, null);
9295
}
9396

97+
/// <summary>
98+
/// Asserts that the subject is an <see cref="JsonResult"/>.
99+
/// </summary>
100+
/// <param name="reason">
101+
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
102+
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
103+
/// </param>
104+
/// <param name="reasonArgs">
105+
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
106+
/// </param>
94107
public JsonResultAssertions BeJsonResult(string reason, params object[] reasonArgs)
95108
{
96109
Execute.Assertion

src/FluentAssertions.AspNetCore.Mvc/JsonResultAssertions.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22
using FluentAssertions.Primitives;
33
using Microsoft.AspNetCore.Mvc;
44
using System;
5+
using System.Diagnostics;
56

67
namespace FluentAssertions.AspNetCore.Mvc
78
{
9+
/// <summary>
10+
/// Contains a number of methods to assert that a <see cref="JsonResult" /> is in the expected state.
11+
/// </summary>
12+
[DebuggerNonUserCode]
813
public class JsonResultAssertions : ObjectAssertions
914
{
1015
#region Public Constructors
1116

17+
/// <summary>
18+
/// Initializes a new instance of the <see cref="T:JsonResultAssertions" /> class.
19+
/// </summary>
20+
/// <param name="subject">The object to test assertion on</param>
1221
public JsonResultAssertions(JsonResult subject) : base(subject)
1322
{
1423

@@ -18,6 +27,11 @@ public JsonResultAssertions(JsonResult subject) : base(subject)
1827

1928
#region Public Properties
2029

30+
/// <summary>
31+
/// The value on the JsonResult
32+
/// </summary>
33+
public object Value => JsonResultSubject.Value;
34+
2135
#endregion
2236

2337
#region Private Properties
@@ -28,6 +42,18 @@ public JsonResultAssertions(JsonResult subject) : base(subject)
2842

2943
#region Public Methods
3044

45+
/// <summary>
46+
/// Asserts that the value is the expected value using Equals.
47+
/// </summary>
48+
/// <param name="expectedValue">The expected value.</param>
49+
/// <param name="reason">
50+
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
51+
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
52+
/// </param>
53+
/// <param name="reasonArgs">
54+
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
55+
/// </param>
56+
/// <returns></returns>
3157
public JsonResultAssertions WithValue(object expectedValue, string reason = "",
3258
params object[] reasonArgs)
3359
{

0 commit comments

Comments
 (0)