From f351f51f8fe7d9a3a2154d1eb1eb3560a0eb9d51 Mon Sep 17 00:00:00 2001 From: ByteBlast Date: Thu, 11 Sep 2014 17:42:00 +0100 Subject: [PATCH 1/2] Reduced code indentation in README. --- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e7d69f4..7debb41 100644 --- a/README.md +++ b/README.md @@ -43,34 +43,34 @@ Make sure to check out [the documentation](http://docs.teststack.net/fluentmvcte Say you set up the following test class (this example with NUnit, but it will work for any test framework). ```c# - using MyApp.Controllers; - using NUnit.Framework; - using TestStack.FluentMVCTesting; - - namespace MyApp.Tests.Controllers +using MyApp.Controllers; +using NUnit.Framework; +using TestStack.FluentMVCTesting; + +namespace MyApp.Tests.Controllers +{ + [TestFixture] + class HomeControllerShould { - [TestFixture] - class HomeControllerShould - { - private HomeController _controller; + private HomeController _controller; - [SetUp] - public void Setup() - { - _controller = new HomeController(); - } + [SetUp] + public void Setup() + { + _controller = new HomeController(); } } +} ``` Then you can create a test like this: ```c# - [Test] - public void Render_default_view_for_get_to_index() - { - _controller.WithCallTo(c => c.Index()).ShouldRenderDefaultView(); - } +[Test] +public void Render_default_view_for_get_to_index() +{ + _controller.WithCallTo(c => c.Index()).ShouldRenderDefaultView(); +} ``` This checks that when `_controller.Index()` is called then the `ActionResult` that is returned is of type `ViewResult` and that the view name returned is either "Index" or "" (the default view for the Index action); easy huh? From 5e07e0ae5039f665dad5a5e690c02b36a988e5a3 Mon Sep 17 00:00:00 2001 From: ByteBlast Date: Thu, 11 Sep 2014 17:45:37 +0100 Subject: [PATCH 2/2] Updated consumer samples in README. --- README.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7debb41..244d382 100644 --- a/README.md +++ b/README.md @@ -105,16 +105,21 @@ _controller.WithCallTo(c => c.Index()) .ShouldRedirectTo(c => c.SomeAction()); _controller.WithCallTo(c => c.Index()) - .ShouldRenderFile("text/plain"); + .ShouldRenderAnyFile("content/type"); + +_controller.WithCallTo(c => c.Index()) + .ShouldRenderFileContents("text"); + +_controller.WithCallTo(c => c.Index()) + .ShouldReturnContent("expected content"); _controller.WithCallTo(c => c.Index()) .ShouldGiveHttpStatus(404); _controller.WithCallTo(c => c.Index()).ShouldReturnJson(data => - { - Assert.That(data.SomeProperty, Is.EqualTo("SomeValue"); - } -); +{ + Assert.That(data.SomeProperty, Is.EqualTo("SomeValue"); +}); ``` Any questions, comments or additions?