SPRNET-1497 added explicit support for aspnetmvc4
This commit is contained in:
@@ -71,14 +71,14 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="objectsMvc3.xml">
|
||||
<Content Include="objectsMvc.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="namedContextObjectsMvc3.xml">
|
||||
<Content Include="namedContextObjectsMvc.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace Spring.Web.Mvc.Tests
|
||||
public void _TestSetup()
|
||||
{
|
||||
ContextRegistry.Clear();
|
||||
_context = new MvcApplicationContext("file://objectsMvc3.xml");
|
||||
_mvcNamedContext = new MvcApplicationContext("named", false, "file://namedContextObjectsMvc3.xml");
|
||||
_context = new MvcApplicationContext("file://objectsMvc.xml");
|
||||
_mvcNamedContext = new MvcApplicationContext("named", false, "file://namedContextObjectsMvc.xml");
|
||||
|
||||
ContextRegistry.RegisterContext(_context);
|
||||
ContextRegistry.RegisterContext(_mvcNamedContext);
|
||||
@@ -71,9 +71,9 @@ namespace Spring.Web.Mvc.Tests
|
||||
[Test]
|
||||
public void CanUseUnnamedContextToResolveType()
|
||||
{
|
||||
Assert.That(SpringMvcDependencyResolver.ApplicationContextName, Is.Empty, "PRECONDITION: Resolver has named-context improperly set!");
|
||||
Assume.That(SpringMvcDependencyResolver.ApplicationContextName, Is.Empty, "Resolver should not have a named-context set for this test!");
|
||||
|
||||
var service = _resolver.GetService(typeof (FirstContainerRegisteredController));
|
||||
var service = _resolver.GetService<FirstContainerRegisteredController>();
|
||||
Assert.NotNull(service);
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Spring.Web.Mvc.Tests
|
||||
[Test]
|
||||
public void CanReturnCollectionOfTypes()
|
||||
{
|
||||
var services = _resolver.GetServices(typeof(FirstContainerRegisteredController));
|
||||
var services = _resolver.GetServices<FirstContainerRegisteredController>();
|
||||
Assert.That(services.Count(), Is.EqualTo(2));
|
||||
|
||||
foreach (var service in services)
|
||||
@@ -99,21 +99,21 @@ namespace Spring.Web.Mvc.Tests
|
||||
[Test]
|
||||
public void RequestForSingleInstanceOfMultiplyRegisteredTypeReturnsFirstDefinition()
|
||||
{
|
||||
var service = (FirstContainerRegisteredController)_resolver.GetService(typeof(FirstContainerRegisteredController));
|
||||
var service = _resolver.GetService<FirstContainerRegisteredController>();
|
||||
Assert.That(service.TestValue, Is.EqualTo("First Definition of Type"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RequestForSingleUndefinedTypeReturnsNull()
|
||||
{
|
||||
var service = _resolver.GetService(typeof(NotInContainerController));
|
||||
var service = _resolver.GetService<NotInContainerController>();
|
||||
Assert.That(service, Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RequestForCollectionOfUndefinedTypesReturnsEmptyCollection()
|
||||
{
|
||||
var services = _resolver.GetServices(typeof(NotInContainerController));
|
||||
var services = _resolver.GetServices<NotInContainerController>();
|
||||
Assert.That(services, Is.Empty);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
<objects xmlns="http://www.springframework.net"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
|
||||
<object id="NamedContextController" singleton="false" type="Spring.Web.Mvc.Tests.Controllers.NamedContextController, Spring.Web.Mvc3.Tests"/>
|
||||
<object id="NamedContextController" singleton="false" type="Spring.Web.Mvc.Tests.Controllers.NamedContextController"/>
|
||||
</objects>
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
xsi:schemaLocation="http://www.springframework.net http://www.springframework.net/xsd/spring-objects.xsd">
|
||||
|
||||
<!--id/name intentionally excluded from this definition so that we can ensure retrieve-by-type-match works-->
|
||||
<object singleton="false" type="Spring.Web.Mvc.Tests.Controllers.FirstContainerRegisteredController, Spring.Web.Mvc3.Tests">
|
||||
<object singleton="false" type="Spring.Web.Mvc.Tests.Controllers.FirstContainerRegisteredController">
|
||||
<property name="TestValue" value="First Definition of Type" />
|
||||
</object>
|
||||
|
||||
<!--this object defintion matches the controller name that would be retrieved based on the actual request-->
|
||||
<object id="FirstContainerRegistered" singleton="false" type="Spring.Web.Mvc.Tests.Controllers.FirstContainerRegisteredController, Spring.Web.Mvc3.Tests">
|
||||
<object id="FirstContainerRegistered" singleton="false" type="Spring.Web.Mvc.Tests.Controllers.FirstContainerRegisteredController">
|
||||
<property name="TestValue" value="Not First Definition of Type" />
|
||||
</object>
|
||||
|
||||
<object id="SecondContainerRegisteredController" singleton="false" type="Spring.Web.Mvc.Tests.Controllers.SecondContainerRegisteredController, Spring.Web.Mvc3.Tests"/>
|
||||
<object id="SecondContainerRegisteredController" singleton="false" type="Spring.Web.Mvc.Tests.Controllers.SecondContainerRegisteredController"/>
|
||||
|
||||
</objects>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{7B2FB412-047C-4A34-A0D9-3F3D2727F388}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.Web.Mvc4.Tests</RootNamespace>
|
||||
<AssemblyName>Spring.Web.Mvc4.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.Net.2010\Spring.Web.Mvc4.Tests\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_3_5;NET_4_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\..\..\lib\Net\2.0\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\CommonAssemblyInfo.cs">
|
||||
<Link>CommonAssemblyInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Web.Mvc3.Tests\ControllerFactoryTestExtension.cs">
|
||||
<Link>ControllerFactoryTestExtension.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Web.Mvc3.Tests\Controllers\FirstContainerRegisteredController.cs">
|
||||
<Link>Controllers\FirstContainerRegisteredController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Web.Mvc3.Tests\Controllers\NamedContextController.cs">
|
||||
<Link>Controllers\NamedContextController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Web.Mvc3.Tests\Controllers\NotInContainerController.cs">
|
||||
<Link>Controllers\NotInContainerController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Web.Mvc3.Tests\Controllers\SecondContainerRegisteredController.cs">
|
||||
<Link>Controllers\SecondContainerRegisteredController.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\Spring.Web.Mvc3.Tests\SpringMvcDependencyResolverTests.cs">
|
||||
<Link>SpringMvcDependencyResolverTests.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Core\Spring.Core.2010.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2010</Name>
|
||||
<Private>True</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\src\Spring\Spring.Web.Mvc4\Spring.Web.Mvc4.2010.csproj">
|
||||
<Project>{904C97E0-3667-4D12-A55F-6CC2E6F68A0A}</Project>
|
||||
<Name>Spring.Web.Mvc4.2010</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\Spring.Web.Mvc3.Tests\namedContextObjectsMvc.xml">
|
||||
<Link>namedContextObjectsMvc.xml</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="..\Spring.Web.Mvc3.Tests\objectsMvc.xml">
|
||||
<Link>objectsMvc.xml</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" ?>
|
||||
<project name="Spring.Web.Mvc3.Tests" default="test" xmlns="http://nant.sf.net/schemas/nant.xsd">
|
||||
|
||||
<include buildfile="${spring.basedir}/common-project.include" />
|
||||
<!--
|
||||
Required properties:
|
||||
* current.bin.dir - (path) root level to build to
|
||||
* build.debug - (true|false) debug build?
|
||||
* current.build.defines.csc - framework-specific build defines
|
||||
* lib.dir - framework-specific assembly references
|
||||
-->
|
||||
<target name="build">
|
||||
<!-- build Spring.Web.Mvc -->
|
||||
<csc target="library" define="${current.build.defines.csc}"
|
||||
warnaserror="true"
|
||||
optimize="${build.optimize}"
|
||||
debug="${current.build.debug}"
|
||||
output="${current.bin.dir}/${project::get-name()}.dll"
|
||||
doc="${current.bin.dir}/${project::get-name()}.xml">
|
||||
<nowarn>
|
||||
<warning number="${nowarn.numbers.test}" /> <!-- 1701 -->
|
||||
<warning number="${nowarn.numbers.test},1587" if="${nant.settings.currentframework=='mono-2.0'}"/>
|
||||
</nowarn>
|
||||
<sources failonempty="true">
|
||||
<include name="**/*.cs" />
|
||||
<include name="../CommonAssemblyInfo.cs" />
|
||||
<include name="../Spring.Web.Mvc3.Tests/**/*.cs" />
|
||||
</sources>
|
||||
<resources prefix="Spring" dynamicprefix="true" failonempty="true">
|
||||
<include name="../Spring.Web.Mvc3.Tests/**/*.resx" />
|
||||
<include name="../Spring.Web.Mvc3.Tests/**/*.xsd" />
|
||||
<include name="../Spring.Web.Mvc3.Tests/**/*.txt" />
|
||||
<include name="../Spring.Web.Mvc3.Tests/**/*.xml" />
|
||||
<exclude name="../Spring.Web.Mvc3.Tests/Data/**/*" />
|
||||
<exclude name="../Spring.Web.Mvc3.Tests/obj/**/*" />
|
||||
</resources>
|
||||
<references basedir="${current.bin.dir}">
|
||||
<include name="*.dll" />
|
||||
<include name="System.Configuration.dll" if="${nant.settings.currentframework=='mono-2.0'}" />
|
||||
<include name="System.Drawing.dll" if="${nant.settings.currentframework=='mono-2.0'}" />
|
||||
<include name="System.Xml.dll" if="${nant.settings.currentframework=='mono-2.0'}" />
|
||||
<include name="System.Web.dll" if="${nant.settings.currentframework=='mono-2.0'}" />
|
||||
<include name="System.Web.Services.dll" if="${nant.settings.currentframework=='mono-2.0'}" />
|
||||
<include name="System.Data.dll" if="${nant.settings.currentframework=='mono-2.0'}" />
|
||||
|
||||
<include name="System.Web.Abstractions.dll"/>
|
||||
<include name="System.Web.Routing.dll"/>
|
||||
|
||||
<include name="C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Mvc.dll" />
|
||||
<include name="C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Assemblies\System.Web.Mvc.dll" />
|
||||
|
||||
|
||||
<exclude name="${project::get-name()}.dll" />
|
||||
|
||||
<include name="${lib.dir}/nunit.core.interfaces.dll" />
|
||||
<exclude name="System.Web.Extensions.dll" />
|
||||
<exclude name="Spring.Web.Mvc.dll" />
|
||||
<exclude name="Spring.Web.Mvc.Tests.dll" />
|
||||
</references>
|
||||
</csc>
|
||||
<copy todir="${current.bin.dir}">
|
||||
<fileset basedir="${project::get-base-directory()}/Data">
|
||||
<include name="**/*.*" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${current.bin.dir}">
|
||||
<fileset basedir="${project::get-base-directory()}">
|
||||
<include name="**/*.xml" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="test" depends="build">
|
||||
<!-- property name="test.assemblyname" value="${project::get-name()}" / -->
|
||||
<call target="common.run-tests" />
|
||||
</target>
|
||||
<!--
|
||||
<target name="test" depends="build">
|
||||
<nunit2outproc>
|
||||
<formatter type="Plain" />
|
||||
<formatter type="Xml" usefile="true" extension=".xml" outputdir="${current.bin.dir}/results" />
|
||||
<test assemblyname="${current.bin.dir}/${project::get-name()}.dll" />
|
||||
</nunit2outproc>
|
||||
</target>
|
||||
-->
|
||||
</project>
|
||||
Reference in New Issue
Block a user