Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Added integration tests for MVC areas after receiving issue #240
Browse files Browse the repository at this point in the history
  • Loading branch information
nikmd23 committed Jan 18, 2013
1 parent 702c771 commit e6b22cd
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 1 deletion.
@@ -0,0 +1,23 @@
using System.Web.Mvc;

namespace Glimpse.Test.Integration.Site.Areas.Area
{
public class AreaAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Area";
}
}

public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Area_default",
"Area/{controller}/{action}/{id}",
new { controller = "HomeArea", action = "Index", id = UrlParameter.Optional });
}
}
}
@@ -0,0 +1,15 @@
using System.Web.Mvc;

namespace Glimpse.Test.Integration.Site.Areas.Area.Controllers
{
public class HomeAreaController : Controller
{
public ActionResult Index()
{
var areaName = ControllerContext.RouteData.DataTokens["area"].ToString();
HttpContext.Items.Add(IntegrationTestTab.Expected, areaName);

return View(model: areaName);
}
}
}
@@ -0,0 +1,5 @@
@model string

<h2>HomeArea/Index</h2>

<p>This is a test to ensure that Glimpse supports MVC Area's. The name of the current area ("@Model") will be displayed in the integration tab.</p>
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
</head>

<body>
@RenderBody()
</body>
</html>
58 changes: 58 additions & 0 deletions source/Glimpse.Test.Integration.Site/Areas/Area/Views/Web.config
@@ -0,0 +1,58 @@
<?xml version="1.0"?>

<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>

<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>

<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>

<system.web>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>

<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />

<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>
@@ -0,0 +1,3 @@
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
Expand Up @@ -73,6 +73,8 @@
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Compile Include="Areas\Area\AreaAreaRegistration.cs" />
<Compile Include="Areas\Area\Controllers\HomeAreaController.cs" />
<Compile Include="Code\DomainData.cs" />
<Compile Include="Code\DomainRoute.cs" />
<Compile Include="Controllers\HomeController.cs" />
Expand All @@ -88,7 +90,9 @@
<Content Include="favicon.ico" />
<Content Include="Global.asax" />
<Content Include="Content\Site.css" />
<Content Include="Web.config" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
<Content Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</Content>
Expand All @@ -111,6 +115,7 @@
<Content Include="Views\Shared\_Layout.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\Area\Models\" />
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
Expand All @@ -122,6 +127,18 @@
<ItemGroup>
<Content Include="Views\Routing\Subdomain.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Areas\Area\Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Areas\Area\Views\HomeArea\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Areas\Area\Views\Shared\_Layout.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Areas\Area\Views\_ViewStart.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
Binary file modified source/Glimpse.Test.Integration/Tests.xls
Binary file not shown.

4 comments on commit e6b22cd

@avanderhoorn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loving these tests mate!

@avanderhoorn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought. I'm left wondering if we need to bring the MVC, etc tests out of this integration projects into another integration project - what happens when we get MVC4 up and running and want to test it.

@nikmd23
Copy link
Member Author

@nikmd23 nikmd23 commented on e6b22cd Jan 24, 2013 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avanderhoorn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

Please sign in to comment.