Skip to content

Commit

Permalink
Merge pull request #35 from rikrak/FixDocRefComments
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkuszyk committed Feb 21, 2018
2 parents ae40b80 + feb27c2 commit 031682d
Show file tree
Hide file tree
Showing 14 changed files with 91 additions and 27 deletions.
18 changes: 12 additions & 6 deletions src/FluentAssertions.Mvc.Shared/ActionResultAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ namespace FluentAssertions.Mvc
[DebuggerNonUserCode]
public class ActionResultAssertions : ObjectAssertions
{
/// <summary>
/// Contains fixed values used in assertions
/// </summary>
public struct Constants
{
/// <summary>
/// A shared failure message
/// </summary>
public const string CommonFailMessage = "Expected ActionResult to be {0}{reason}, but found {1}";
}

Expand Down Expand Up @@ -52,7 +58,7 @@ public ContentResultAssertions BeContentResult()
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public ContentResultAssertions BeContentResult(string reason, params object[] reasonArgs)
{
Expand Down Expand Up @@ -80,7 +86,7 @@ public EmptyResult BeEmptyResult()
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public EmptyResult BeEmptyResult(string reason, params object[] reasonArgs)
{
Expand Down Expand Up @@ -108,7 +114,7 @@ public RedirectToRouteAssertions BeRedirectToRouteResult()
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectToRouteAssertions BeRedirectToRouteResult(string reason, params object[] reasonArgs)
{
Expand Down Expand Up @@ -136,7 +142,7 @@ public PartialViewResultAssertions BePartialViewResult()
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public PartialViewResultAssertions BePartialViewResult(string reason, params object[] reasonArgs)
{
Expand Down Expand Up @@ -164,7 +170,7 @@ public RedirectResultAssertions BeRedirectResult()
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectResultAssertions BeRedirectResult(string reason, params object[] reasonArgs)
{
Expand Down Expand Up @@ -192,7 +198,7 @@ public ViewResultAssertions BeViewResult()
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public ViewResultAssertions BeViewResult(string reason, params object[] reasonArgs)
{
Expand Down
6 changes: 3 additions & 3 deletions src/FluentAssertions.Mvc.Shared/ContentResultAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ContentResultAssertions(ContentResult subject) : base(subject)
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public ContentResultAssertions WithContent(string expectedContent, string reason = "", params object[] reasonArgs)
{
Expand All @@ -60,7 +60,7 @@ public ContentResultAssertions WithContent(string expectedContent, string reason
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public ContentResultAssertions WithContentType(string expectedContentType, string reason = "", params object[] reasonArgs)
{
Expand Down Expand Up @@ -89,7 +89,7 @@ public ContentResultAssertions WithContentType(string expectedContentType, strin
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public ContentResultAssertions WithContentEncoding(Encoding expectedEncoding, string reason = "", params object[] reasonArgs)
{
Expand Down
6 changes: 6 additions & 0 deletions src/FluentAssertions.Mvc.Shared/ControllerAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@

namespace FluentAssertions.Mvc
{
/// <summary>
/// Container for methods that assert that a <see cref="System.Web.Mvc.ControllerBase"/> is in the expected state.
/// </summary>
[DebuggerNonUserCode]
public class ControllerAssertions
{
/// <summary>
/// Creates a new instance of <see cref="ControllerAssertions"/>
/// </summary>
public ControllerAssertions ()
{
}
Expand Down
11 changes: 11 additions & 0 deletions src/FluentAssertions.Mvc.Shared/Fakes/FakeHttpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,26 @@

namespace FluentAssertions.Mvc.Fakes
{
/// <summary>
/// Mimics a <see cref="HttpContextBase"/>. For use in testing.
/// </summary>
public class FakeHttpContext : HttpContextBase
{
private FakeHttpRequest _request;
private FakeHttpResponse _response;

/// <summary>
/// Creates a new instance of <see cref="FakeHttpContext"/>
/// </summary>
/// <param name="appPath"></param>
/// <param name="relativeUrl"></param>
public FakeHttpContext(string appPath, string relativeUrl)
{
_request = new FakeHttpRequest(appPath, relativeUrl);
_response = new FakeHttpResponse();
}

/// <inheritdoc />
public override HttpRequestBase Request
{
get
Expand All @@ -23,6 +32,7 @@ public override HttpRequestBase Request
}
}

/// <inheritdoc />
public override HttpResponseBase Response
{
get
Expand All @@ -31,6 +41,7 @@ public override HttpResponseBase Response
}
}

/// <inheritdoc />
public override object GetService(Type serviceType)
{
return new FakeHttpWorkerRequest();
Expand Down
12 changes: 12 additions & 0 deletions src/FluentAssertions.Mvc.Shared/Fakes/FakeHttpRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@

namespace FluentAssertions.Mvc.Fakes
{
/// <summary>
/// Mimics a <see cref="HttpRequestBase"/>. Used for testing
/// </summary>
public class FakeHttpRequest : HttpRequestBase
{
private string _appRelativePath;
private string _appPath;

/// <summary>
/// Creates a new instance of <see cref="FakeHttpRequest"/>
/// </summary>
/// <param name="appPath"></param>
/// <param name="relativePath"></param>
public FakeHttpRequest(string appPath, string relativePath)
{
_appPath = appPath;
Expand All @@ -26,6 +34,7 @@ private string fixRelativeUrl(string url)
return url;
}

/// <inheritdoc />
public override string ApplicationPath
{
get
Expand All @@ -34,6 +43,7 @@ public override string ApplicationPath
}
}

/// <inheritdoc />
public override string AppRelativeCurrentExecutionFilePath
{
get
Expand All @@ -42,6 +52,7 @@ public override string AppRelativeCurrentExecutionFilePath
}
}

/// <inheritdoc />
public override string PathInfo
{
get
Expand All @@ -50,6 +61,7 @@ public override string PathInfo
}
}

/// <inheritdoc />
public override NameValueCollection ServerVariables
{
get
Expand Down
4 changes: 4 additions & 0 deletions src/FluentAssertions.Mvc.Shared/Fakes/FakeHttpResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

namespace FluentAssertions.Mvc.Fakes
{
/// <summary>
/// Mimics a <see cref="HttpResponseBase"/>. For use in testing.
/// </summary>
public class FakeHttpResponse : HttpResponseBase
{
/// <inheritdoc />
public override string ApplyAppPathModifier(string virtualPath)
{
return virtualPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@

namespace FluentAssertions.Mvc
{
/// <summary>
/// Container for methods that can verify the state or behaviour of a <see cref="PartialViewResult"/>
/// </summary>
[DebuggerNonUserCode]
public class PartialViewResultAssertions : ViewResultBaseAssertions<PartialViewResult>
{
/// <summary>
/// Creates a new instance of <see cref="PartialViewResultAssertions"/>
/// </summary>
/// <param name="viewResult"></param>
public PartialViewResultAssertions(PartialViewResult viewResult) : base(viewResult) { }
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/FluentAssertions.Mvc.Shared/RedirectResultAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public RedirectResultAssertions(RedirectResult subject) : base(subject) { }
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectResultAssertions WithUrl(string expectedUrl, string reason = "", params object[] reasonArgs)
{
Expand All @@ -58,7 +58,7 @@ public RedirectResultAssertions WithUrl(string expectedUrl, string reason = "",
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectResultAssertions WithPermanent(bool expectedPermanent, string reason = "", params object[] reasonArgs)
{
Expand Down
12 changes: 6 additions & 6 deletions src/FluentAssertions.Mvc.Shared/RedirectToRouteAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public RedirectToRouteAssertions(RedirectToRouteResult subject)
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectToRouteAssertions WithPermanent(bool expectedPermanent, string reason = "", params object[] reasonArgs)
{
Expand All @@ -55,7 +55,7 @@ public RedirectToRouteAssertions WithPermanent(bool expectedPermanent, string re
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectToRouteAssertions WithRouteName(string expectedRouteName, string reason = "", params object[] reasonArgs)
{
Expand All @@ -81,7 +81,7 @@ public RedirectToRouteAssertions WithRouteName(string expectedRouteName, string
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectToRouteAssertions WithRouteValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
{
Expand All @@ -98,7 +98,7 @@ public RedirectToRouteAssertions WithRouteValue(string key, object expectedValue
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectToRouteAssertions WithController(string expectedControllerName, string reason = "", params object[] reasonArgs)
{
Expand All @@ -115,7 +115,7 @@ public RedirectToRouteAssertions WithController(string expectedControllerName, s
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectToRouteAssertions WithAction(string expectedAction, string reason = "", params object[] reasonArgs)
{
Expand All @@ -132,7 +132,7 @@ public RedirectToRouteAssertions WithAction(string expectedAction, string reason
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RedirectToRouteAssertions WithArea(string expectedArea, string reason = "", params object[] reasonArgs)
{
Expand Down
9 changes: 9 additions & 0 deletions src/FluentAssertions.Mvc.Shared/RouteCollection_Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@

namespace FluentAssertions.Mvc
{
/// <summary>
/// Container for extension methods for <see cref="RouteCollection"/>
/// </summary>
[DebuggerNonUserCode]
public static class RouteCollection_Extensions
{
/// <summary>
/// Spoofs a call to <see cref="RouteCollection.GetRouteData(System.Web.HttpContextBase)"/> with the use of a stub <see cref="System.Web.HttpContextBase"/>.
/// </summary>
/// <param name="routes">The <see cref="RouteCollection"/> to spoof the call on.</param>
/// <param name="url">The url of interest</param>
/// <returns>A <see cref="RouteCollection"/> for the given <paramref name="url"/></returns>
public static RouteData GetRouteDataForUrl(this RouteCollection routes, string url)
{
var context = new FakeHttpContext("/", url);
Expand Down
10 changes: 5 additions & 5 deletions src/FluentAssertions.Mvc.Shared/RouteDataAssertions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

namespace FluentAssertions.Mvc
{
[DebuggerNonUserCode]
/// <summary>
/// Contains a number of methods to assert that a <see cref="RouteData"/> is in the expected state.
/// </summary>
[DebuggerNonUserCode]
public class RouteDataAssertions : ObjectAssertions
{
/// <summary>
Expand All @@ -38,7 +38,7 @@ public RouteDataAssertions(RouteData subject)
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RouteDataAssertions HaveController(string expectedControllerName, string reason = "", params object[] reasonArgs)
{
Expand All @@ -55,7 +55,7 @@ public RouteDataAssertions HaveController(string expectedControllerName, string
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RouteDataAssertions HaveAction(string expectedActionName, string reason = "", params object[] reasonArgs)
{
Expand All @@ -73,7 +73,7 @@ public RouteDataAssertions HaveAction(string expectedActionName, string reason =
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RouteDataAssertions HaveDataToken(string key, object expectedValue, string reason = "", params object[] reasonArgs)
{
Expand Down Expand Up @@ -104,7 +104,7 @@ public RouteDataAssertions HaveDataToken(string key, object expectedValue, strin
/// is needed. If the phrase does not start with the word <i>because</i>, it is prepended automatically.
/// </param>
/// <param name="reasonArgs">
/// Zero or more objects to format using the placeholders in <see cref="reason" />.
/// Zero or more objects to format using the placeholders in <paramref name="reason"/>.
/// </param>
public RouteDataAssertions HaveValue(string key, object expectedValue, string reason = "", params object[] reasonArgs)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@

namespace FluentAssertions.Mvc
{
/// <summary>
/// Contains extension methods for <see cref="RouteValueDictionary"/>
/// </summary>
public static class RouteValueDictionary_Extensions
{
/// <summary>
/// Wraps a call to <see cref="UrlHelper.GenerateUrl(string, string, string, RouteValueDictionary, RouteCollection, RequestContext, bool)"/> using a stub <see cref="System.Web.HttpContextBase"/>
/// </summary>
/// <param name="routeValues">The <see cref="RouteValueDictionary"/> to generate the URL from</param>
/// <param name="routes">a <see cref="RouteCollection"/> for use when generating a URL</param>
/// <returns>A URL value generated from the given <paramref name="routeValues"/> and <paramref name="routes"/></returns>
public static string GenerateUrl(this RouteValueDictionary routeValues, RouteCollection routes)
{
var context = new FakeHttpContext("/", "~/");
Expand Down
Loading

0 comments on commit 031682d

Please sign in to comment.