Wrox Programmer Forums
|
BOOK: Beginning ASP.NET MVC 1.0 ISBN: 978-0-470-43399-7
This is the forum to discuss the Wrox book Beginning ASP.NET MVC 1.0 by Simone Chiaretta, Keyvan Nayyeri; ISBN: 9780470433997
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET MVC 1.0 ISBN: 978-0-470-43399-7 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2009, 09:13 AM
Authorized User
 
Join Date: Dec 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default Chapter 9 The Cookie test

Hi!

In chapter 9, System.Web.Abstractions Testing With Mocking, my test fails and the code is written exactly as in the book.

What happens is that

Code:
        [TestMethod]
        public void About()
        {
            // Arrange
            HomeController controller = new HomeController();
            controller.ControllerContext = new ControllerContext(mockHttpContext, new RouteData(), controller);

            // Act
            ActionResult actionResult = controller.About();

            // Assert
            ViewResult result = actionResult as ViewResult;
            Assert.IsNotNull(result, "Not a RenderView Result");
            ViewDataDictionary viewData = result.ViewData;
            Assert.AreEqual("Yesterday", viewData["LastLogin"]);
            mocks.VerifyAll();
returns that where it expected "Yesterday", it's actually null.

What could be the error?
 
Old December 10th, 2009, 10:11 AM
Authorized User
 
Join Date: Dec 2009
Posts: 12
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I missed adding the cookie value in the viewdata in the ActionResult. :)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Cookie Chapter 8 ? phirun BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 13 May 27th, 2005 11:19 AM
Problem with set cookie chapter 8 stephen_c_ BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 December 15th, 2004 02:35 PM
Cookie Error when run web page test.aspx C#.net minhpx General .NET 1 August 10th, 2004 01:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.