in Education by
I'm using restful routing module for asp.net mvc and very happy with it. But I can't get one thing. For example I had a controller action like this: public ActionResult Index() { if (Request.IsAjaxRequest()) return PartialView(); return View(); } And had no problem with writing a spec like this: [Subject(typeof(LotsController))] public class When_Index_called { static LotsController controller; static ActionResult actionResult; Establish context = () => { controller = mocker.Create(); controller.ControllerContext = Contexts.Controller.Default; }; Because of = () => actionResult = controller.Index(); It should_render_view = () => actionResult.AssertViewRendered().ForViewWithDefaultName(); But with use of rest, I want to have an Index method like this: public ActionResult Index() { return RespondTo(format => { format.Html = () => { if (Request.IsAjaxRequest()) return PartialView(); return View(); }; format.Json = () => Json(new { }); }); } Sure that previous spec fails, because action result is not of type ViewResult, its of type FormatResult. FormatResult by itself overrides ExecuteResult method that returns void. How can I unit test such case if I want to verify action result types and data inside FormatResult? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
In the future version of restful routing such code is possible: var formatResult = actionResult as FormatResult; ActionResult result = formatResult.ExposeResult().Html(); result.ShouldBeOfType();

Related questions

0 votes
    I have batch of user accounts and every user account's password is not crypted.I want to insert to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have already tried to make a login form and I also want to display the user login profile that ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I have already tried to make a login form and I also want to display the user login profile that ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I need to integrate IDX MLS into a real estate website. Also I want to know how to implement ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I ... was posted previously etc.. What I'd like to do is...
asked Mar 23, 2022 in Education by JackTerrance
0 votes
    I'm looking to build an reusable control or custom helper for my MVC project. I'm sure there is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm looking to build an reusable control or custom helper for my MVC project. I'm sure there is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'm looking to build an reusable control or custom helper for my MVC project. I'm sure there is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I ... was posted previously etc.. What I'd like to do is...
asked Mar 19, 2022 in Education by JackTerrance
0 votes
    I'd like to use two view engines in my asp.net mvc web application. The first one is the Brail ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    Which are the events of an ASP .Net server control and how does their order relate to the containing ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    I want to assign DataReader value to a DataSet, is there any method which helps to do this? JavaScript ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I want to assign DataReader value to a DataSet, is there any method which helps to do this? JavaScript ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I am developing a .NET core application with Identity login which provides a Bootstrap form In the /Identity ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    If I want to use the validation framework that you can use with ASP.NET MVC, will the JavaScript ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 24, 2022 in Education by JackTerrance
...