Skip to content

Commit 9103a95

Browse files
committed
Added overload for ShouldGiveHttpStatus that takes a HttpStatusCode rather than an int
1 parent d2d37be commit 9103a95

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

FluentMVCTesting.Tests/ControllerResultTestTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq.Expressions;
4+
using System.Net;
45
using System.Web.Mvc;
56
using FluentMVCTesting.Tests.TestControllers;
67
using NUnit.Framework;
@@ -307,7 +308,7 @@ public void Check_for_file_result_and_check_content_type()
307308
[Test]
308309
public void Check_for_http_not_found()
309310
{
310-
_controller.WithCallTo(c => c.NotFound()).ShouldGiveHttpStatus(404);
311+
_controller.WithCallTo(c => c.NotFound()).ShouldGiveHttpStatus(HttpStatusCode.NotFound);
311312
}
312313

313314
[Test]

FluentMVCTesting/ControllerResultTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Linq.Expressions;
3+
using System.Net;
34
using System.Reflection;
45
using System.Text.RegularExpressions;
56
using System.Web.Mvc;
@@ -237,6 +238,11 @@ public void ShouldGiveHttpStatus(int status)
237238
throw new ActionResultAssertionException(string.Format("Expected HTTP status code to be '{0}', but instead received a '{1}'.", status, statusCodeResult.StatusCode));
238239
}
239240

241+
public void ShouldGiveHttpStatus(HttpStatusCode status)
242+
{
243+
ShouldGiveHttpStatus((int) status);
244+
}
245+
240246
#endregion
241247

242248
#region JSON

0 commit comments

Comments
 (0)