Skip to content

Commit 89f03a4

Browse files
committed
Merge pull request #19 from ByteBlast/master
Added support for checking for a file path result.
2 parents 93cd31e + 3010253 commit 89f03a4

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

TestStack.FluentMVCTesting.Tests/ControllerResultTestTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ControllerResultTestShould
2626
ReturnType<PartialViewResult>(t => t.ShouldRenderDefaultPartialView()),
2727
ReturnType<FileContentResult>(t => t.ShouldRenderFile()),
2828
ReturnType<FileStreamResult>(t => t.ShouldRenderFileStream()),
29+
ReturnType<FilePathResult>(t=> t.ShouldRenderFilePath()),
2930
ReturnType<HttpStatusCodeResult>(t => t.ShouldGiveHttpStatus()),
3031
ReturnType<JsonResult>(t => t.ShouldReturnJson()),
3132
};
@@ -324,6 +325,12 @@ public void Check_for_file_stream_result_and_check_content_type()
324325
_controller.WithCallTo(c => c.EmptyStream()).ShouldRenderFileStream(ControllerResultTestController.FileContentType);
325326
}
326327

328+
[Test]
329+
public void Check_for_file_path_result()
330+
{
331+
_controller.WithCallTo(c => c.EmptyFilePath()).ShouldRenderFilePath();
332+
}
333+
327334
#endregion
328335

329336
#region HTTP Status tests

TestStack.FluentMVCTesting.Tests/TestControllers/ControllerResultTestController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ public ActionResult EmptyStream()
142142
return File(content, FileContentType);
143143
}
144144

145+
public ActionResult EmptyFilePath()
146+
{
147+
return File("dummy", FileContentType);
148+
}
149+
145150
public ActionResult NamedView()
146151
{
147152
return View(ViewName);

TestStack.FluentMvcTesting/ControllerResultTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,12 @@ public FileStreamResult ShouldRenderFileStream(string contentType = null)
238238
return fileResult;
239239
}
240240

241+
public FilePathResult ShouldRenderFilePath()
242+
{
243+
ValidateActionReturnType<FilePathResult>();
244+
return (FilePathResult)_actionResult;
245+
}
246+
241247
#endregion
242248

243249
#region Http Status

0 commit comments

Comments
 (0)