Populating initial tree

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4038902
This commit is contained in:
rpaquay
2009-11-07 22:49:58 +00:00
parent 4bbf4167c2
commit 2d3cd1b304
700 changed files with 222319 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
using System.Web.Mvc;
using NUnit.Framework;
using Orchard.Web.Controllers;
namespace Orchard.Web.Tests.Controllers {
[TestFixture]
public class HomeControllerTests {
[Test]
public void IndexAndAboutShouldReturnViews() {
var controller = new HomeController();
var result1 = controller.Index();
var result2 = controller.About();
Assert.That(result1, Is.TypeOf<ViewResult>());
Assert.That(result2, Is.TypeOf<ViewResult>());
}
}
}

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F112851D-B023-4746-B6B1-8D2E5AD8F7AA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Web.Tests</RootNamespace>
<AssemblyName>Orchard.Web.Tests</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</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="Autofac, Version=1.4.4.561, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\autofac\Autofac.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.5.2.9222, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\nunit\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Controllers\HomeControllerTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Routes\RouteTests.cs" />
<Compile Include="Stubs\StubContext.cs" />
<Compile Include="Stubs\StubRequest.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Orchard.Web\Orchard.Web.csproj">
<Project>{50B779EA-EC00-4699-84C0-03B395C365D2}</Project>
<Name>Orchard.Web</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard\Orchard.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard</Name>
</ProjectReference>
</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>

View File

@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Orchard.Web.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Orchard.Web.Tests")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3a698957-646d-476c-90e8-47553fec9203")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,88 @@
using System.Web.Routing;
using NUnit.Framework;
using Orchard.Web.Tests.Stubs;
namespace Orchard.Web.Tests.Routes {
[TestFixture]
public class RouteTests {
[Test]
public void RouteForEmbeddedResource() {
// Arrange
var context = new StubContext("~/foo.axd/bar/baz/biff");
var routes = new RouteCollection();
MvcApplication.RegisterRoutes(routes);
// Act
var routeData = routes.GetRouteData(context);
// Assert
Assert.That(routeData, Is.Not.Null);
Assert.That(routeData.RouteHandler, Is.TypeOf<StopRoutingHandler>());
}
[Test]
public void RouteWithControllerNoActionNoId() {
// Arrange
var context = new StubContext("~/controller1");
var routes = new RouteCollection();
MvcApplication.RegisterRoutes(routes);
// Act
var routeData = routes.GetRouteData(context);
// Assert
Assert.That(routeData, Is.Not.Null);
Assert.That(routeData.Values["controller"], Is.EqualTo("controller1"));
Assert.That(routeData.Values["action"], Is.EqualTo("Index"));
Assert.That(routeData.Values["id"], Is.EqualTo(""));
}
[Test]
public void RouteWithControllerWithActionNoId() {
// Arrange
var context = new StubContext("~/controller1/action2");
var routes = new RouteCollection();
MvcApplication.RegisterRoutes(routes);
// Act
var routeData = routes.GetRouteData(context);
// Assert
Assert.That(routeData, Is.Not.Null);
Assert.That(routeData.Values["controller"], Is.EqualTo("controller1"));
Assert.That(routeData.Values["action"], Is.EqualTo("action2"));
Assert.That(routeData.Values["id"], Is.EqualTo(""));
}
[Test]
public void RouteWithControllerWithActionWithId() {
// Arrange
var context = new StubContext("~/controller1/action2/id3");
var routes = new RouteCollection();
MvcApplication.RegisterRoutes(routes);
// Act
var routeData = routes.GetRouteData(context);
// Assert
Assert.That(routeData, Is.Not.Null);
Assert.That(routeData.Values["controller"], Is.EqualTo("controller1"));
Assert.That(routeData.Values["action"], Is.EqualTo("action2"));
Assert.That(routeData.Values["id"], Is.EqualTo("id3"));
}
[Test]
public void RouteWithTooManySegments() {
// Arrange
var context = new StubContext("~/a/b/c/d");
var routes = new RouteCollection();
MvcApplication.RegisterRoutes(routes);
// Act
var routeData = routes.GetRouteData(context);
// Assert
Assert.That(routeData, Is.Null);
}
}
}

View File

@@ -0,0 +1,15 @@
using System.Web;
namespace Orchard.Web.Tests.Stubs {
internal class StubContext : HttpContextBase {
private readonly StubRequest request;
public StubContext(string relativeUrl) {
request = new StubRequest(relativeUrl);
}
public override HttpRequestBase Request {
get { return request; }
}
}
}

View File

@@ -0,0 +1,19 @@
using System.Web;
namespace Orchard.Web.Tests.Stubs {
public class StubRequest : HttpRequestBase {
private readonly string relativeUrl;
public StubRequest(string relativeUrl) {
this.relativeUrl = relativeUrl;
}
public override string AppRelativeCurrentExecutionFilePath {
get { return relativeUrl; }
}
public override string PathInfo {
get { return ""; }
}
}
}