Mercurial > altnet-hispano
annotate Agendas/trunk/src/Agendas.Web.Tests/Controllers/MvcControllerTestsBase.cs @ 298:9bc60d166c8a
Se corrigieron los tests por el cambio de Patrocinador, para que no persista el logo en disco.
Se comentó el código de PatrocinadorApiController, que no se utiliza.
author | juanjose.montesdeocaarbos |
---|---|
date | Sun, 19 Feb 2012 16:00:38 -0300 |
parents | bf993f99cee3 |
children |
rev | line source |
---|---|
262 | 1 using System.Web; |
2 using System.Web.Mvc; | |
275
bf993f99cee3
Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents:
270
diff
changeset
|
3 using System.Web.Routing; |
262 | 4 using Moq; |
5 | |
6 namespace Agendas.Web.Tests.Controllers | |
7 { | |
8 public class MvcControllerTestsBase | |
9 { | |
275
bf993f99cee3
Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents:
270
diff
changeset
|
10 protected ControllerContext ControllerCtx = new ControllerContext(); |
262 | 11 |
12 protected static TModel BindModel<TModel>(Controller controller, IValueProvider valueProvider) where TModel : class | |
13 { | |
14 var binder = ModelBinders.Binders.GetBinder(typeof(TModel)); | |
15 var bindingContext = new ModelBindingContext() | |
16 { | |
17 FallbackToEmptyPrefix = true, | |
18 ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, typeof(TModel)), | |
19 ModelName = "NotUsedButNotNull", | |
20 ModelState = controller.ModelState, | |
21 PropertyFilter = (name => true), | |
22 ValueProvider = valueProvider | |
23 }; | |
24 | |
275
bf993f99cee3
Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents:
270
diff
changeset
|
25 return (TModel)binder.BindModel(controller.ControllerContext, bindingContext); |
262 | 26 } |
27 } | |
28 } |