diff --git a/examples/Spring/Spring.MvcQuickStart/src/Spring.MvcQuickStart/Web.config b/examples/Spring/Spring.MvcQuickStart/src/Spring.MvcQuickStart/Web.config index 7f475a45..33ecd43b 100644 --- a/examples/Spring/Spring.MvcQuickStart/src/Spring.MvcQuickStart/Web.config +++ b/examples/Spring/Spring.MvcQuickStart/src/Spring.MvcQuickStart/Web.config @@ -36,7 +36,7 @@ - + diff --git a/src/Spring/Spring.Web.Mvc/Context/Support/MvcApplicationContext.cs b/src/Spring/Spring.Web.Mvc/Context/Support/MvcApplicationContext.cs index bfb6cf4b..9484fdbd 100644 --- a/src/Spring/Spring.Web.Mvc/Context/Support/MvcApplicationContext.cs +++ b/src/Spring/Spring.Web.Mvc/Context/Support/MvcApplicationContext.cs @@ -31,7 +31,7 @@ namespace Spring.Context.Support /// /// Application Context for ASP.NET MVC Applications /// - public class MvcApplicationContext : AbstractXmlApplicationContext + public class MvcApplicationContext : WebApplicationContext { private readonly string[] _configurationLocations; diff --git a/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.2010.csproj b/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.2010.csproj index f14e2a9e..7a848db7 100644 --- a/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.2010.csproj +++ b/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.2010.csproj @@ -10,7 +10,7 @@ Properties Spring.Web.Mvc Spring.Web.Mvc - v4.0 + v3.5 512 @@ -66,6 +66,10 @@ Spring.Core.2010 True + + {BA4789EB-281A-48EA-8763-28B9F0596A18} + Spring.Web.2010 + diff --git a/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.nuspec b/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.nuspec index ae76f81c..e0d28116 100644 --- a/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.nuspec +++ b/src/Spring/Spring.Web.Mvc/Spring.Web.Mvc.nuspec @@ -14,6 +14,7 @@ + diff --git a/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.nuspec b/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.nuspec index 48dc18fc..79fb81c1 100644 --- a/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.nuspec +++ b/src/Spring/Spring.Web.Mvc3/Spring.Web.Mvc3.nuspec @@ -14,6 +14,7 @@ + diff --git a/test/Spring/Spring.Web.Mvc.Tests/Spring.Web.Mvc.Tests.2010.csproj b/test/Spring/Spring.Web.Mvc.Tests/Spring.Web.Mvc.Tests.2010.csproj index 466a5941..c893f1aa 100644 --- a/test/Spring/Spring.Web.Mvc.Tests/Spring.Web.Mvc.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Mvc.Tests/Spring.Web.Mvc.Tests.2010.csproj @@ -69,6 +69,14 @@ {5166CE3A-14BE-478A-88DA-729A39DE1E29} Spring.Web.Mvc.2010 + + {BA4789EB-281A-48EA-8763-28B9F0596A18} + Spring.Web.2010 + + + {C67E47AA-1ACD-41B4-A465-4D336A2319CA} + Spring.Web.Tests.2010 + diff --git a/test/Spring/Spring.Web.Mvc.Tests/SpringControllerFactoryTests.cs b/test/Spring/Spring.Web.Mvc.Tests/SpringControllerFactoryTests.cs index 3bcb46fa..6fb30138 100644 --- a/test/Spring/Spring.Web.Mvc.Tests/SpringControllerFactoryTests.cs +++ b/test/Spring/Spring.Web.Mvc.Tests/SpringControllerFactoryTests.cs @@ -29,6 +29,7 @@ using Spring.Core.IO; using Spring.Objects.Factory; using Spring.Objects.Factory.Xml; using System.Web.Mvc; +using Spring.TestSupport; using Spring.Web.Mvc.Tests.Controllers; using Spring.Context.Support; using System.Reflection; @@ -49,26 +50,29 @@ namespace Spring.Web.Mvc.Tests [SetUp] public void _TestSetup() { - ContextRegistry.Clear(); - _context = new MvcApplicationContext("file://objects.xml"); - _mvcNamedContext = new MvcApplicationContext("named", false, "file://namedContextObjects.xml"); - - ContextRegistry.RegisterContext(_context); - ContextRegistry.RegisterContext(_mvcNamedContext); - - _factory = new SpringControllerFactory(); - - //due to ridiculous internal methods in DefaultControllerFactory, have to set the ControllerTypeCache using this extension method - // see http://stackoverflow.com/questions/727181/asp-net-mvc-system-web-compilation-compilationlock for more info - _factory.InitializeWithControllerTypes(new[] + using (new VirtualEnvironmentMock("/somedir/some.file", null, null, "/", true)) { - typeof(FirstContainerRegisteredController), - typeof(SecondContainerRegisteredController), - typeof(NotInContainerController), - typeof(NamedContextController), - }); + ContextRegistry.Clear(); + _context = new MvcApplicationContext("file://objects.xml"); + _mvcNamedContext = new MvcApplicationContext("named", false, "file://namedContextObjects.xml"); - SpringControllerFactory.ApplicationContextName = string.Empty; + ContextRegistry.RegisterContext(_context); + ContextRegistry.RegisterContext(_mvcNamedContext); + + _factory = new SpringControllerFactory(); + + //due to ridiculous internal methods in DefaultControllerFactory, have to set the ControllerTypeCache using this extension method + // see http://stackoverflow.com/questions/727181/asp-net-mvc-system-web-compilation-compilationlock for more info + _factory.InitializeWithControllerTypes(new[] + { + typeof (FirstContainerRegisteredController), + typeof (SecondContainerRegisteredController), + typeof (NotInContainerController), + typeof (NamedContextController), + }); + + SpringControllerFactory.ApplicationContextName = string.Empty; + } } [Test] @@ -87,11 +91,13 @@ namespace Spring.Web.Mvc.Tests [Test] public void CanRevertToTypeMatchIfIdMatchUnsuccessful() { - MvcApplicationContext context = new MvcApplicationContext("file://objectsMatchByType.xml"); - - ContextRegistry.Clear(); - ContextRegistry.RegisterContext(context); + using (new VirtualEnvironmentMock("/somedir/some.file", null, null, "/", true)) + { + MvcApplicationContext context = new MvcApplicationContext("file://objectsMatchByType.xml"); + ContextRegistry.Clear(); + ContextRegistry.RegisterContext(context); + } IController controller = _factory.CreateController(new RequestContext(new MockContext(), new RouteData()), "FirstContainerRegistered"); Assert.AreEqual("Should_Be_Matched_By_Type", ((FirstContainerRegisteredController)controller).TestValue);