Files
_controller.WithCallTo(c => c.Index()).ShouldRenderAnyFile();
_controller.WithCallTo(c => c.Index()).ShouldRenderAnyFile("content/type");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileContents();
_controller.WithCallTo(c => c.Index()).ShouldRenderFileContents(new byte[] {1});
_controller.WithCallTo(c => c.Index()).ShouldRenderFileContents(new byte[] {1}, "content/type");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileContents("text");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileContents("text", "content/type");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileContents("text", "content/type", Encoding.Unicode);
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream();
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream(new byte[] {1});
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream(new byte[] {1}, "content/type");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream(new MemoryStream());
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream(new MemoryStream(), "content/type");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream("text");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream("text", "content/type");
_controller.WithCallTo(c => c.Index()).ShouldRenderFileStream("text", "content/type", Encoding.Unicode);
_controller.WithCallTo(c => c.Index()).ShouldRenderFilePath();
_controller.WithCallTo(c => c.Index()).ShouldRenderFilePath("file name");
_controller.WithCallTo(c => c.Index()).ShouldRenderFilePath("file name", "content/type");
It is useful to note that whilst file content is ultimately represented in memory as binary data, we enable you to test for textual content using convenience overloads.
In order achieve this - internally we reconstitute the text by assuming that the file content is UTF8 encoded. If you know our assumption to be wrong then you must explicitly tell the test method the actual file content encoding by means of the apparent encoding
argument as not to cause a misleading test failure.
Updated less than a minute ago