Skip to content

Commit 54974d7

Browse files
author
Carl Healy
committed
Add Integration test for Razor Build Task
Is configured not to build by default, as it is impossible to stop VS from locking the BuildTask DLL from RazorRockstars.BuildTask it relies on.
1 parent 3d2303d commit 54974d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1522
-0
lines changed

src/ServiceStack.sln

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Razor.BuildTas
157157
EndProject
158158
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RazorRockstars.BuildTask", "..\tests\RazorRockstars.BuildTask\RazorRockstars.BuildTask.csproj", "{62E10C68-4357-410F-8217-A9D19DD77F29}"
159159
EndProject
160+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServiceStack.Razor.BuildTask.IntegrationTests", "..\tests\ServiceStack.Razor.BuildTask.IntegrationTests\ServiceStack.Razor.BuildTask.IntegrationTests.csproj", "{1CEFE4A6-3845-436F-A393-505683658521}"
161+
EndProject
160162
Global
161163
GlobalSection(SolutionConfigurationPlatforms) = preSolution
162164
Debug|Any CPU = Debug|Any CPU
@@ -1629,6 +1631,39 @@ Global
16291631
{62E10C68-4357-410F-8217-A9D19DD77F29}.STATIC_ONLY NO_EXPRESSIONS|Mixed Platforms.ActiveCfg = Release|Any CPU
16301632
{62E10C68-4357-410F-8217-A9D19DD77F29}.STATIC_ONLY NO_EXPRESSIONS|Mixed Platforms.Build.0 = Release|Any CPU
16311633
{62E10C68-4357-410F-8217-A9D19DD77F29}.STATIC_ONLY NO_EXPRESSIONS|x86.ActiveCfg = Release|Any CPU
1634+
{1CEFE4A6-3845-436F-A393-505683658521}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1635+
{1CEFE4A6-3845-436F-A393-505683658521}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
1636+
{1CEFE4A6-3845-436F-A393-505683658521}.Debug|x86.ActiveCfg = Debug|Any CPU
1637+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoDebug|Any CPU.ActiveCfg = Debug|Any CPU
1638+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoDebug|Any CPU.Build.0 = Debug|Any CPU
1639+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoDebug|Mixed Platforms.ActiveCfg = Debug|Any CPU
1640+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoDebug|Mixed Platforms.Build.0 = Debug|Any CPU
1641+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoDebug|x86.ActiveCfg = Debug|Any CPU
1642+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoRelease|Any CPU.ActiveCfg = Release|Any CPU
1643+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoRelease|Any CPU.Build.0 = Release|Any CPU
1644+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoRelease|Mixed Platforms.ActiveCfg = Release|Any CPU
1645+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoRelease|Mixed Platforms.Build.0 = Release|Any CPU
1646+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoRelease|x86.ActiveCfg = Release|Any CPU
1647+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoTouch|Any CPU.ActiveCfg = Release|Any CPU
1648+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoTouch|Any CPU.Build.0 = Release|Any CPU
1649+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoTouch|Mixed Platforms.ActiveCfg = Release|Any CPU
1650+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoTouch|Mixed Platforms.Build.0 = Release|Any CPU
1651+
{1CEFE4A6-3845-436F-A393-505683658521}.MonoTouch|x86.ActiveCfg = Release|Any CPU
1652+
{1CEFE4A6-3845-436F-A393-505683658521}.Release|Any CPU.ActiveCfg = Release|Any CPU
1653+
{1CEFE4A6-3845-436F-A393-505683658521}.Release|Any CPU.Build.0 = Release|Any CPU
1654+
{1CEFE4A6-3845-436F-A393-505683658521}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
1655+
{1CEFE4A6-3845-436F-A393-505683658521}.Release|Mixed Platforms.Build.0 = Release|Any CPU
1656+
{1CEFE4A6-3845-436F-A393-505683658521}.Release|x86.ActiveCfg = Release|Any CPU
1657+
{1CEFE4A6-3845-436F-A393-505683658521}.Signed|Any CPU.ActiveCfg = Release|Any CPU
1658+
{1CEFE4A6-3845-436F-A393-505683658521}.Signed|Any CPU.Build.0 = Release|Any CPU
1659+
{1CEFE4A6-3845-436F-A393-505683658521}.Signed|Mixed Platforms.ActiveCfg = Release|Any CPU
1660+
{1CEFE4A6-3845-436F-A393-505683658521}.Signed|Mixed Platforms.Build.0 = Release|Any CPU
1661+
{1CEFE4A6-3845-436F-A393-505683658521}.Signed|x86.ActiveCfg = Release|Any CPU
1662+
{1CEFE4A6-3845-436F-A393-505683658521}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.ActiveCfg = Release|Any CPU
1663+
{1CEFE4A6-3845-436F-A393-505683658521}.STATIC_ONLY NO_EXPRESSIONS|Any CPU.Build.0 = Release|Any CPU
1664+
{1CEFE4A6-3845-436F-A393-505683658521}.STATIC_ONLY NO_EXPRESSIONS|Mixed Platforms.ActiveCfg = Release|Any CPU
1665+
{1CEFE4A6-3845-436F-A393-505683658521}.STATIC_ONLY NO_EXPRESSIONS|Mixed Platforms.Build.0 = Release|Any CPU
1666+
{1CEFE4A6-3845-436F-A393-505683658521}.STATIC_ONLY NO_EXPRESSIONS|x86.ActiveCfg = Release|Any CPU
16321667
EndGlobalSection
16331668
GlobalSection(SolutionProperties) = preSolution
16341669
HideSolutionNode = FALSE
@@ -1653,6 +1688,7 @@ Global
16531688
{9982317F-831C-478B-9CC3-57F888BCD97A} = {4EBD29DD-21A1-47B5-80DB-F9D58C91BED5}
16541689
{3E676B1A-7F6B-477F-A144-E3C934A59C91} = {4EBD29DD-21A1-47B5-80DB-F9D58C91BED5}
16551690
{62E10C68-4357-410F-8217-A9D19DD77F29} = {4EBD29DD-21A1-47B5-80DB-F9D58C91BED5}
1691+
{1CEFE4A6-3845-436F-A393-505683658521} = {4EBD29DD-21A1-47B5-80DB-F9D58C91BED5}
16561692
{C57AF946-06A7-4CFC-BC4D-F9E7AE4FC5C8} = {EB65E771-6C97-4D64-8E11-FD88AE48A41A}
16571693
{5AE1CD9C-B726-4ABA-A8B7-E74435064783} = {EB65E771-6C97-4D64-8E11-FD88AE48A41A}
16581694
{C53331DF-3690-4AEA-AB57-70672BCFA086} = {7EA56692-5E60-4469-A166-ECF19DE2B607}

src/packages/repositories.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<repository path="..\..\tests\ServiceStack.AuthWeb.Tests\packages.config" />
99
<repository path="..\..\tests\ServiceStack.Common.Tests\packages.config" />
1010
<repository path="..\..\tests\ServiceStack.Mvc.Tests\packages.config" />
11+
<repository path="..\..\tests\ServiceStack.Razor.BuildTask.IntegrationTests\packages.config" />
1112
<repository path="..\..\tests\ServiceStack.Razor.BuildTask.Tests\packages.config" />
1213
<repository path="..\..\tests\ServiceStack.Razor.Tests\packages.config" />
1314
<repository path="..\..\tests\ServiceStack.RazorHostTests\packages.config" />
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
using System.Net;
2+
using Funq;
3+
using ServiceStack;
4+
using ServiceStack.Auth;
5+
using ServiceStack.Data;
6+
using ServiceStack.Logging;
7+
using ServiceStack.OrmLite;
8+
using ServiceStack.Razor;
9+
10+
//The entire C# code for the stand-alone RazorRockstars demo.
11+
namespace RazorRockstars.WebHost
12+
{
13+
using System.Reflection;
14+
15+
public class AppHost : AppHostBase
16+
{
17+
public AppHost() : base("Test Razor", typeof(Rockstar).Assembly) { }
18+
19+
public override void Configure(Container container)
20+
{
21+
LogManager.LogFactory = new ConsoleLogFactory();
22+
23+
Plugins.Add(new RazorFormat { ScanAssemblies = new[] { typeof(Rockstar).Assembly } });
24+
25+
container.Register<IDbConnectionFactory>(
26+
new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider));
27+
28+
using (var db = container.Resolve<IDbConnectionFactory>().OpenDbConnection())
29+
{
30+
db.CreateTableIfNotExists<Rockstar>();
31+
db.InsertAll(RockstarsService.SeedData);
32+
}
33+
34+
this.CustomErrorHttpHandlers[HttpStatusCode.NotFound] = new RazorHandler("/notfound");
35+
this.CustomErrorHttpHandlers[HttpStatusCode.Unauthorized] = new RazorHandler("/login");
36+
37+
//AddAuthentication(container); //Uncomment to enable User Authentication
38+
}
39+
40+
private void AddAuthentication(Container container)
41+
{
42+
container.Register<IUserAuthRepository>(c =>
43+
new OrmLiteAuthRepository(c.Resolve<IDbConnectionFactory>()));
44+
45+
container.Resolve<IUserAuthRepository>().InitSchema();
46+
47+
Plugins.Add(new AuthFeature(() => new AuthUserSession(),
48+
new IAuthProvider[] {
49+
new CredentialsAuthProvider(),
50+
}
51+
));
52+
}
53+
}
54+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<%@ Application Codebehind="Global.asax.cs" Inherits="ServiceStack.Razor.BuildTask.IntegrationTests.Global" Language="C#" %>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace ServiceStack.Razor.BuildTask.IntegrationTests
2+
{
3+
using System;
4+
5+
using RazorRockstars.WebHost;
6+
7+
using ServiceStack.MiniProfiler;
8+
9+
public class Global : System.Web.HttpApplication
10+
{
11+
12+
protected void Application_Start(object sender, EventArgs e)
13+
{
14+
new AppHost().Init();
15+
}
16+
17+
protected void Application_BeginRequest(object src, EventArgs e)
18+
{
19+
if (Request.IsLocal)
20+
Profiler.Start();
21+
}
22+
23+
protected void Application_EndRequest(object src, EventArgs e)
24+
{
25+
Profiler.Stop();
26+
}
27+
}
28+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("RazorRockstars.WebHost")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("RazorRockstars.WebHost")]
13+
[assembly: AssemblyCopyright("Copyright © 2012")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("079a45c7-065e-464d-a273-ef05803c64bc")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
namespace ServiceStack.Razor.BuildTask.Tests
2+
{
3+
using System;
4+
5+
using NUnit.Framework;
6+
7+
[TestFixture]
8+
public class Tests
9+
{
10+
[Test]
11+
public void All_Views_Exist_In_Assembly()
12+
{
13+
Assert.NotNull(Type.GetType("RazorRockstars.__default, RazorRockstars.BuildTask"));
14+
Assert.NotNull(Type.GetType("RazorRockstars.__Login, RazorRockstars.BuildTask"));
15+
Assert.NotNull(Type.GetType("RazorRockstars.__NoModelNoController, RazorRockstars.BuildTask"));
16+
Assert.NotNull(Type.GetType("RazorRockstars.__NotFound, RazorRockstars.BuildTask"));
17+
Assert.NotNull(Type.GetType("RazorRockstars.__TypedModelNoController, RazorRockstars.BuildTask"));
18+
19+
Assert.NotNull(Type.GetType("RazorRockstars.stars.alive.__Grohl, RazorRockstars.BuildTask"));
20+
Assert.NotNull(Type.GetType("RazorRockstars.stars.alive.___Layout, RazorRockstars.BuildTask"));
21+
Assert.NotNull(Type.GetType("RazorRockstars.stars.alive.Love.__default, RazorRockstars.BuildTask"));
22+
Assert.NotNull(Type.GetType("RazorRockstars.stars.alive.Springsteen.__default, RazorRockstars.BuildTask"));
23+
Assert.NotNull(Type.GetType("RazorRockstars.stars.alive.Vedder.__default, RazorRockstars.BuildTask"));
24+
25+
Assert.NotNull(Type.GetType("RazorRockstars.stars.dead.___Layout, RazorRockstars.BuildTask"));
26+
Assert.NotNull(Type.GetType("RazorRockstars.stars.dead.Cobain.__default, RazorRockstars.BuildTask"));
27+
Assert.NotNull(Type.GetType("RazorRockstars.stars.dead.Hendrix.__default, RazorRockstars.BuildTask"));
28+
Assert.NotNull(Type.GetType("RazorRockstars.stars.dead.Jackson.__default, RazorRockstars.BuildTask"));
29+
Assert.NotNull(Type.GetType("RazorRockstars.stars.dead.Joplin.__default, RazorRockstars.BuildTask"));
30+
Assert.NotNull(Type.GetType("RazorRockstars.stars.dead.Presley.__default, RazorRockstars.BuildTask"));
31+
32+
Assert.NotNull(Type.GetType("RazorRockstars.Views.__AngularJS, RazorRockstars.BuildTask"));
33+
Assert.NotNull(Type.GetType("RazorRockstars.Views.___Layout, RazorRockstars.BuildTask"));
34+
Assert.NotNull(Type.GetType("RazorRockstars.Views.__Rockstars, RazorRockstars.BuildTask"));
35+
36+
Assert.NotNull(Type.GetType("RazorRockstars.Views.Shared.__Empty, RazorRockstars.BuildTask"));
37+
Assert.NotNull(Type.GetType("RazorRockstars.Views.Shared.__HtmlReport, RazorRockstars.BuildTask"));
38+
Assert.NotNull(Type.GetType("RazorRockstars.Views.Shared.__MenuAlive, RazorRockstars.BuildTask"));
39+
Assert.NotNull(Type.GetType("RazorRockstars.Views.Shared.__MenuDead, RazorRockstars.BuildTask"));
40+
Assert.NotNull(Type.GetType("RazorRockstars.Views.Shared.__OtherPages, RazorRockstars.BuildTask"));
41+
Assert.NotNull(Type.GetType("RazorRockstars.Views.Shared.__SimpleLayout, RazorRockstars.BuildTask"));
42+
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)