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
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
1 using System.Web;
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
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
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
4 using Moq;
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
5
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
6 namespace Agendas.Web.Tests.Controllers
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
7 {
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
8 public class MvcControllerTestsBase
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
9 {
275
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 270
diff changeset
10 protected ControllerContext ControllerCtx = new ControllerContext();
262
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
11
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
12 protected static TModel BindModel<TModel>(Controller controller, IValueProvider valueProvider) where TModel : class
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
13 {
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
14 var binder = ModelBinders.Binders.GetBinder(typeof(TModel));
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
15 var bindingContext = new ModelBindingContext()
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
16 {
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
17 FallbackToEmptyPrefix = true,
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
18 ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(null, typeof(TModel)),
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
19 ModelName = "NotUsedButNotNull",
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
20 ModelState = controller.ModelState,
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
21 PropertyFilter = (name => true),
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
22 ValueProvider = valueProvider
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
23 };
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
24
275
bf993f99cee3 Ticket #123: Patrocinadores de las vans.
juanjose.montesdeocaarbos
parents: 270
diff changeset
25 return (TModel)binder.BindModel(controller.ControllerContext, bindingContext);
262
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
26 }
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
27 }
b87a4875b2b6 ControllerTests: Refactoring.
juanjose.montesdeocaarbos
parents:
diff changeset
28 }