This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added integration tests for MVC areas after receiving issue #240
- Loading branch information
Showing
8 changed files
with
133 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
source/Glimpse.Test.Integration.Site/Areas/Area/AreaAreaRegistration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }); | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
source/Glimpse.Test.Integration.Site/Areas/Area/Controllers/HomeAreaController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
source/Glimpse.Test.Integration.Site/Areas/Area/Views/HomeArea/Index.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
11 changes: 11 additions & 0 deletions
11
source/Glimpse.Test.Integration.Site/Areas/Area/Views/Shared/_Layout.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
58
source/Glimpse.Test.Integration.Site/Areas/Area/Views/Web.config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
3 changes: 3 additions & 0 deletions
3
source/Glimpse.Test.Integration.Site/Areas/Area/Views/_ViewStart.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@{ | ||
Layout = "~/Views/Shared/_Layout.cshtml"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
e6b22cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loving these tests mate!
e6b22cd
There was a problem hiding this comment.
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.
e6b22cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e6b22cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.