Skip to content

Commit b85136c

Browse files
committed
Arranged file related tests into regions.
1 parent a77895c commit b85136c

File tree

3 files changed

+25
-18
lines changed

3 files changed

+25
-18
lines changed

TestStack.FluentMVCTesting.Tests/ControllerResultTestTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ public void Check_for_invalid_partial_name()
300300
);
301301
Assert.That(exception.Message, Is.EqualTo(string.Format("Expected result view to be '{0}', but instead was given '{1}'.", ControllerResultTestController.PartialName, ControllerResultTestController.RandomViewName)));
302302
}
303+
#endregion
303304

305+
#region File tests
304306
[Test]
305307
public void Check_for_file_result()
306308
{
@@ -342,7 +344,6 @@ public void Check_for_file_path_result_and_check_file_name_and_check_content_typ
342344
{
343345
_controller.WithCallTo(c => c.EmptyFilePath()).ShouldRenderFilePath(ControllerResultTestController.FileName, ControllerResultTestController.FileContentType);
344346
}
345-
346347
#endregion
347348

348349
#region HTTP Status tests

TestStack.FluentMVCTesting.Tests/TestControllers/ControllerResultTestController.cs

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,41 +131,43 @@ public ActionResult DefaultPartialExplicit()
131131
return PartialView("DefaultPartialExplicit");
132132
}
133133

134-
public ActionResult EmptyFile()
134+
public ActionResult NamedView()
135135
{
136-
var content = new byte[] {};
137-
return File(content, FileContentType);
136+
return View(ViewName);
138137
}
139138

140-
public ActionResult EmptyStream()
139+
public ActionResult NamedPartial()
141140
{
142-
var content = new MemoryStream();
143-
return File(content, FileContentType);
141+
return PartialView(PartialName);
144142
}
145143

146-
public ActionResult EmptyFilePath()
144+
public ActionResult RandomView()
147145
{
148-
return File(FileName, FileContentType);
146+
return View(RandomViewName);
149147
}
150148

151-
public ActionResult NamedView()
149+
public ActionResult RandomPartial()
152150
{
153-
return View(ViewName);
151+
return PartialView(RandomViewName);
154152
}
153+
#endregion
155154

156-
public ActionResult NamedPartial()
155+
#region Files
156+
public ActionResult EmptyFile()
157157
{
158-
return PartialView(PartialName);
158+
var content = new byte[] { };
159+
return File(content, FileContentType);
159160
}
160161

161-
public ActionResult RandomView()
162+
public ActionResult EmptyStream()
162163
{
163-
return View(RandomViewName);
164+
var content = new MemoryStream();
165+
return File(content, FileContentType);
164166
}
165167

166-
public ActionResult RandomPartial()
168+
public ActionResult EmptyFilePath()
167169
{
168-
return PartialView(RandomViewName);
170+
return File(FileName, FileContentType);
169171
}
170172
#endregion
171173

TestStack.FluentMvcTesting/ControllerResultTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,10 @@ public ViewResultTest ShouldRenderDefaultPartialView()
210210
return ShouldRenderPartialView(_actionName);
211211
}
212212

213+
#endregion
214+
215+
#region File Results
216+
213217
public FileContentResult ShouldRenderFile(string contentType = null)
214218
{
215219
ValidateActionReturnType<FileContentResult>();
@@ -242,7 +246,7 @@ public FilePathResult ShouldRenderFilePath(string fileName = null, string conten
242246
{
243247
ValidateActionReturnType<FilePathResult>();
244248

245-
var fileResult = (FilePathResult) _actionResult;
249+
var fileResult = (FilePathResult)_actionResult;
246250

247251
if (fileName != null && fileName != fileResult.FileName)
248252
{

0 commit comments

Comments
 (0)