Skip to content

Commit 4195daa

Browse files
committed
Xml comments added and overloads removed.
1 parent ba148a3 commit 4195daa

File tree

2 files changed

+83
-36
lines changed

2 files changed

+83
-36
lines changed

src/FluentAssertions.Mvc3/ViewResultAssertions.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,29 @@
55

66
namespace FluentAssertions.Mvc
77
{
8+
/// <summary>
9+
/// Contains a number of methods to assert that a <see cref="ViewResult"/> is in the expected state.
10+
/// </summary>
811
[DebuggerNonUserCode]
9-
public class ViewResultAssertions : ViewResultBaseAssertions<ViewResult>
12+
public class ViewResultAssertions : ViewResultBaseAssertions<ViewResult>
1013
{
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="T:ViewResultAssertions" /> class.
16+
/// </summary>
1117
public ViewResultAssertions (ViewResult subject) : base(subject) { }
1218

13-
public ViewResultAssertions WithMasterName(string expectedMasterName)
14-
{
15-
WithMasterName(expectedMasterName, string.Empty, null);
16-
return this;
17-
}
18-
19-
public ViewResultAssertions WithMasterName(string expectedMasterName, string reason, params object[] reasonArgs)
19+
/// <summary>
20+
/// Asserts that the master name is the expected master name.
21+
/// </summary>
22+
/// <param name="expectedMasterName">The expected master name.</param>
23+
/// <param name="reason">
24+
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
25+
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
26+
/// </param>
27+
/// <param name="reasonArgs">
28+
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
29+
/// </param>
30+
public ViewResultAssertions WithMasterName(string expectedMasterName, string reason = "", params object[] reasonArgs)
2031
{
2132
string actualMasterName = (Subject as ViewResult).MasterName;
2233

src/FluentAssertions.Mvc3/ViewResultBaseAssertions.cs

Lines changed: 64 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,33 @@
99

1010
namespace FluentAssertions.Mvc
1111
{
12+
/// <summary>
13+
/// Contains a number of methods to assert that a <see cref="ViewResultBase"/> is in the expected state.
14+
/// </summary>
1215
[DebuggerNonUserCode]
1316
public abstract class ViewResultBaseAssertions<T> : ObjectAssertions
1417
where T : ViewResultBase
1518
{
19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="T:ViewResultBaseAssertions" /> class.
21+
/// </summary>
1622
public ViewResultBaseAssertions(ViewResultBase subject) : base(subject)
1723
{
1824
Subject = (T)subject;
1925
}
2026

21-
public ViewResultBaseAssertions<T> WithViewName(string expectedViewName)
22-
{
23-
WithViewName(expectedViewName, string.Empty, null);
24-
return this;
25-
}
26-
27-
public ViewResultBaseAssertions<T> WithViewName(string expectedViewName, string reason, params object[] reasonArgs)
27+
/// <summary>
28+
/// Asserts that the view name is the expected view name.
29+
/// </summary>
30+
/// <param name="expectedViewName">The view name.</param>
31+
/// <param name="reason">
32+
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
33+
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
34+
/// </param>
35+
/// <param name="reasonArgs">
36+
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
37+
/// </param>
38+
public ViewResultBaseAssertions<T> WithViewName(string expectedViewName, string reason = "", params object[] reasonArgs)
2839
{
2940
string actualViewName = (Subject as ViewResultBase).ViewName;
3041

@@ -35,13 +46,19 @@ public ViewResultBaseAssertions<T> WithViewName(string expectedViewName, string
3546
return this;
3647
}
3748

38-
public ViewResultBaseAssertions<T> WithViewData(string key, object expectedValue)
39-
{
40-
WithViewData(key, expectedValue, string.Empty, null);
41-
return this;
42-
}
43-
44-
public ViewResultBaseAssertions<T> WithViewData(string key, object expectedValue, string reason, params object[] reasonArgs)
49+
/// <summary>
50+
/// Asserts that the view data contains the expected data.
51+
/// </summary>
52+
/// <param name="key">The expected view data key.</param>
53+
/// <param name="expectedValue">The expected view data.</param>
54+
/// <param name="reason">
55+
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
56+
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
57+
/// </param>
58+
/// <param name="reasonArgs">
59+
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
60+
/// </param>
61+
public ViewResultBaseAssertions<T> WithViewData(string key, object expectedValue, string reason = "", params object[] reasonArgs)
4562
{
4663
ViewDataDictionary actualViewData = (Subject as ViewResultBase).ViewData;
4764

@@ -60,13 +77,19 @@ public ViewResultBaseAssertions<T> WithViewData(string key, object expectedValue
6077
return this;
6178
}
6279

63-
public ViewResultBaseAssertions<T> WithTempData(string key, object expectedValue)
64-
{
65-
WithTempData(key, expectedValue, string.Empty, null);
66-
return this;
67-
}
68-
69-
public ViewResultBaseAssertions<T> WithTempData(string key, object expectedValue, string reason, params object[] reasonArgs)
80+
/// <summary>
81+
/// Asserts that the temp data contains the expected data.
82+
/// </summary>
83+
/// <param name="key">The expected temp data key.</param>
84+
/// <param name="expectedValue">The expected temp data.</param>
85+
/// <param name="reason">
86+
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
87+
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
88+
/// </param>
89+
/// <param name="reasonArgs">
90+
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
91+
/// </param>
92+
public ViewResultBaseAssertions<T> WithTempData(string key, object expectedValue, string reason = "", params object[] reasonArgs)
7093
{
7194
TempDataDictionary actualTempData = (Subject as ViewResultBase).TempData;
7295

@@ -80,6 +103,10 @@ public ViewResultBaseAssertions<T> WithTempData(string key, object expectedValue
80103
return this;
81104
}
82105

106+
107+
/// <summary>
108+
/// The model.
109+
/// </summary>
83110
public object Model
84111
{
85112
get
@@ -89,6 +116,11 @@ public object Model
89116
}
90117
}
91118

119+
/// <summary>
120+
/// Asserts the model is of the expected type.
121+
/// </summary>
122+
/// <typeparam name="TModel">The expected type.</typeparam>
123+
/// <returns>The typed model.</returns>
92124
public TModel ModelAs<TModel>()
93125
{
94126
object model = (Subject as ViewResultBase).Model;
@@ -103,13 +135,17 @@ public TModel ModelAs<TModel>()
103135
return (TModel)model;
104136
}
105137

106-
public ViewResultBaseAssertions<T> WithDefaultViewName()
107-
{
108-
WithDefaultViewName(string.Empty, null);
109-
return this;
110-
}
111-
112-
public ViewResultBaseAssertions<T> WithDefaultViewName(string reason, params object[] reasonArgs)
138+
/// <summary>
139+
/// Asserts that the default view will be used.
140+
/// </summary>
141+
/// <param name="reason">
142+
/// A formatted phrase as is supported by <see cref="string.Format(string,object[])" /> explaining why the assertion
143+
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
144+
/// </param>
145+
/// <param name="reasonArgs">
146+
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
147+
/// </param>
148+
public ViewResultBaseAssertions<T> WithDefaultViewName(string reason = "", params object[] reasonArgs)
113149
{
114150
string viewName = (Subject as ViewResultBase).ViewName;
115151

0 commit comments

Comments
 (0)