Mercurial > altnet-hispano
comparison Agendas/trunk/src/Agendas.Web.Tests/Controllers/MvcControllerTestsBase.cs @ 275:bf993f99cee3
Ticket #123: Patrocinadores de las vans.
author | juanjose.montesdeocaarbos |
---|---|
date | Wed, 14 Dec 2011 08:15:44 -0300 |
parents | 3bb779434ae8 |
children |
comparison
equal
deleted
inserted
replaced
274:72a96459f910 | 275:bf993f99cee3 |
---|---|
1 using System.Web; | 1 using System.Web; |
2 using System.Web.Mvc; | 2 using System.Web.Mvc; |
3 using System.Web.Routing; | |
3 using Moq; | 4 using Moq; |
4 | 5 |
5 namespace Agendas.Web.Tests.Controllers | 6 namespace Agendas.Web.Tests.Controllers |
6 { | 7 { |
7 public class MvcControllerTestsBase | 8 public class MvcControllerTestsBase |
8 { | 9 { |
9 protected ControllerContext ControllerCtx = new ControllerContext(); | 10 protected ControllerContext ControllerCtx = new ControllerContext(); |
10 | 11 |
11 protected static TModel BindModel<TModel>(Controller controller, IValueProvider valueProvider) where TModel : class | 12 protected static TModel BindModel<TModel>(Controller controller, IValueProvider valueProvider) where TModel : class |
12 { | 13 { |
13 var binder = ModelBinders.Binders.GetBinder(typeof(TModel)); | 14 var binder = ModelBinders.Binders.GetBinder(typeof(TModel)); |
14 var bindingContext = new ModelBindingContext() | 15 var bindingContext = new ModelBindingContext() |
19 ModelState = controller.ModelState, | 20 ModelState = controller.ModelState, |
20 PropertyFilter = (name => true), | 21 PropertyFilter = (name => true), |
21 ValueProvider = valueProvider | 22 ValueProvider = valueProvider |
22 }; | 23 }; |
23 | 24 |
24 return (TModel)binder.BindModel(controller.ControllerContext, bindingContext); | 25 return (TModel)binder.BindModel(controller.ControllerContext, bindingContext); |
25 } | 26 } |
26 } | 27 } |
27 } | 28 } |