{"_id":"54cfd0413995cf0d0006f73f","user":"54c4ca54686bce0d00efe1b9","category":{"_id":"54cfd0295ff7e617002bbdd9","__v":1,"project":"54cfb736bba1a0230087419e","version":"54cfb736bba1a023008741a1","pages":["54cfd0413995cf0d0006f73f"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-02T19:29:45.527Z","from_sync":false,"order":1,"slug":"examples","title":"Examples"},"__v":2,"project":"54cfb736bba1a0230087419e","version":{"_id":"54cfb736bba1a023008741a1","__v":5,"project":"54cfb736bba1a0230087419e","createdAt":"2015-02-02T17:43:18.560Z","releaseDate":"2015-02-02T17:43:18.560Z","categories":["54cfb737bba1a023008741a2","54cfc6f75ff7e617002bbdae","54cfcbaebba1a023008741fc","54cfd0295ff7e617002bbdd9","54cfd05b3995cf0d0006f741"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-02-02T19:30:09.698Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"Here are some other random examples of assertions that you can make (see the documentation for the full list):\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"var vm = new SomeViewModel();\\n_controller.WithModelErrors().WithCallTo(c => c.Index(vm))\\n    .ShouldRenderDefaultView()\\n    .WithModel(vm);\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldRenderDefaultView()\\n    .WithModel<ModelType>()\\n    .AndModelErrorFor(m => m.Property1).ThatEquals(\\\"The error message.\\\")\\n    .AndModelErrorFor(m => m.Property2);\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldRenderView(\\\"ViewName\\\");\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldReturnEmptyResult();\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldRedirectTo(\\\"http://www.google.com.au/\\\");\\n\\n_controller.WithCallTo(c => c.ActionWithRedirectToAction())\\n    .ShouldRedirectTo(c => c.ActionInSameController);\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldRedirectTo<SomeOtherController>(c => c.SomeAction());\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldRenderAnyFile(\\\"content/type\\\");\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldRenderFileContents(\\\"text\\\");\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldReturnContent(\\\"expected content\\\");\\n\\n_controller.WithCallTo(c => c.Index())\\n    .ShouldGiveHttpStatus(404);\\n\\n_controller.WithCallTo(c => c.Index()).ShouldReturnJson(data =>\\n{\\n    Assert.That(data.SomeProperty, Is.EqualTo(\\\"SomeValue\\\");\\n});\",\n      \"language\": \"csharp\"\n    }\n  ]\n}\n[/block]\nA real-world example can be seen in the `AndTakeUserToASuccessPage` method of the `SuccessfulTeamResetPasswordScenario` code snippet shown in one of [Rob's blog posts](http://robdmoore.id.au/blog/2015/01/26/review-of-jimmy-bogard-holistic-testing/).","excerpt":"","slug":"examples","type":"basic","title":"Examples"}
Here are some other random examples of assertions that you can make (see the documentation for the full list): [block:code] { "codes": [ { "code": "var vm = new SomeViewModel();\n_controller.WithModelErrors().WithCallTo(c => c.Index(vm))\n .ShouldRenderDefaultView()\n .WithModel(vm);\n\n_controller.WithCallTo(c => c.Index())\n .ShouldRenderDefaultView()\n .WithModel<ModelType>()\n .AndModelErrorFor(m => m.Property1).ThatEquals(\"The error message.\")\n .AndModelErrorFor(m => m.Property2);\n\n_controller.WithCallTo(c => c.Index())\n .ShouldRenderView(\"ViewName\");\n\n_controller.WithCallTo(c => c.Index())\n .ShouldReturnEmptyResult();\n\n_controller.WithCallTo(c => c.Index())\n .ShouldRedirectTo(\"http://www.google.com.au/\");\n\n_controller.WithCallTo(c => c.ActionWithRedirectToAction())\n .ShouldRedirectTo(c => c.ActionInSameController);\n\n_controller.WithCallTo(c => c.Index())\n .ShouldRedirectTo<SomeOtherController>(c => c.SomeAction());\n\n_controller.WithCallTo(c => c.Index())\n .ShouldRenderAnyFile(\"content/type\");\n\n_controller.WithCallTo(c => c.Index())\n .ShouldRenderFileContents(\"text\");\n\n_controller.WithCallTo(c => c.Index())\n .ShouldReturnContent(\"expected content\");\n\n_controller.WithCallTo(c => c.Index())\n .ShouldGiveHttpStatus(404);\n\n_controller.WithCallTo(c => c.Index()).ShouldReturnJson(data =>\n{\n Assert.That(data.SomeProperty, Is.EqualTo(\"SomeValue\");\n});", "language": "csharp" } ] } [/block] A real-world example can be seen in the `AndTakeUserToASuccessPage` method of the `SuccessfulTeamResetPasswordScenario` code snippet shown in one of [Rob's blog posts](http://robdmoore.id.au/blog/2015/01/26/review-of-jimmy-bogard-holistic-testing/).