<p><a href="http://stephenwalther.com/blog/archive/2008/07/01/asp-net-mvc-tip-12-faking-the-controller-context.aspx" rel="nofollow noreferrer">http://stephenwalther.com/blog/archive/2008/07/01/asp-net-mvc-tip-12-faking-the-controller-context.aspx</a></p>

<p>This post shows how to test setting a cookie and then seeing it in ViewData. What I what to do is see if the correct cookies were written (values and name). Any reply, blog post or article will be greatly appreciated.</p>

[{'answer_id': 69535, 'author': 'dimarzionist', 'author_id': 10778, 'author_profile': 'https://Stackoverflow.com/users/10778', 'pm_score': -1, 'selected': False, 'text': '<pre><code>function ReadCookie(cookieName) {\n var theCookie=""+document.cookie;\n var ind=theCookie.indexOf(cookieName);\n if (ind==-1 || cookieName=="") return ""; \n var ind1=theCookie.indexOf(\';\',ind);\n if (ind1==-1) ind1=theCookie.length; \n return unescape(theCookie.substring(ind+cookieName.length+1,ind1));\n}\n</code></pre>\n'}, {'answer_id': 69563, 'author': 'White Dragon', 'author_id': 11049, 'author_profile': 'https://Stackoverflow.com/users/11049', 'pm_score': 3, 'selected': False, 'text': '<p>Are you looking for something more like this?  (untested, just typed it up in the reply box)</p>\n\n<pre><code>var cookies = new HttpCookieCollection();\ncontroller.ControllerContext = new FakeControllerContext(controller, cookies);\nvar result = controller.TestCookie() as ViewResult;\nAssert.AreEqual("somevaluethatshouldbethere", cookies["somecookieitem"].Value);\n</code></pre>\n\n<p>As in, did you mean you want to test the writing of a cookie instead of reading one?\nPlease make your request clearer if possible :)</p>\n'}, {'answer_id': 69582, 'author': 'peterorum', 'author_id': 4449, 'author_profile': 'https://Stackoverflow.com/users/4449', 'pm_score': 1, 'selected': False, 'text': '<p>Perhaps you need to pass in a Fake Response object that the cookies are written to, and you test what is returned in that from the Controller.</p>\n'}]
['https://Stackoverflow.com/questions/69188', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/438/']