Skip to content

Commit 812e072

Browse files
committed
Properly init the state of RazorFormat so subsequent tests in same project aren't dirty
1 parent ace0dcb commit 812e072

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

src/ServiceStack.Razor/RazorFormat.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Configuration;
44
using System.IO;
55
using System.Linq;
6+
using System.Threading;
67
using ServiceStack.Common;
78
using ServiceStack.Html;
89
using ServiceStack.Logging;
@@ -48,19 +49,15 @@ public static bool IsRegistered
4849
public static string TemplatePlaceHolder = "@RenderBody()";
4950

5051
// ~/View - Dynamic Pages
51-
public Dictionary<string, ViewPageRef> ViewPages = new Dictionary<string, ViewPageRef>(
52-
StringComparer.CurrentCultureIgnoreCase);
52+
public Dictionary<string, ViewPageRef> ViewPages;
5353

5454
// ~/View/Shared - Dynamic Shared Pages
55-
public Dictionary<string, ViewPageRef> ViewSharedPages = new Dictionary<string, ViewPageRef>(
56-
StringComparer.CurrentCultureIgnoreCase);
55+
public Dictionary<string, ViewPageRef> ViewSharedPages;
5756

5857
//Content Pages outside of ~/View
59-
public Dictionary<string, ViewPageRef> ContentPages = new Dictionary<string, ViewPageRef>(
60-
StringComparer.CurrentCultureIgnoreCase);
58+
public Dictionary<string, ViewPageRef> ContentPages;
6159

62-
public Dictionary<string, ViewPageRef> MasterPageTemplates = new Dictionary<string, ViewPageRef>(
63-
StringComparer.CurrentCultureIgnoreCase);
60+
public Dictionary<string, ViewPageRef> MasterPageTemplates;
6461

6562
public IAppHost AppHost { get; set; }
6663

@@ -260,6 +257,13 @@ public string RenderPartial(string pageName, object model, bool renderHtml, IHtt
260257

261258
public void Init()
262259
{
260+
ViewPages = new Dictionary<string, ViewPageRef>(StringComparer.CurrentCultureIgnoreCase);
261+
// ~/View/Shared - Dynamic Shared Pages
262+
ViewSharedPages = new Dictionary<string, ViewPageRef>(StringComparer.CurrentCultureIgnoreCase);
263+
//Content Pages outside of ~/View
264+
ContentPages = new Dictionary<string, ViewPageRef>(StringComparer.CurrentCultureIgnoreCase);
265+
MasterPageTemplates = new Dictionary<string, ViewPageRef>(StringComparer.CurrentCultureIgnoreCase);
266+
263267
//Force Binder to load
264268
var loaded = typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly != null;
265269
if (!loaded)

0 commit comments

Comments
 (0)