diff --git a/src/Umbraco.Tests/LibraryTests.cs b/src/Umbraco.Tests/LibraryTests.cs index 25e1ecb1b8..fb09fdc3a2 100644 --- a/src/Umbraco.Tests/LibraryTests.cs +++ b/src/Umbraco.Tests/LibraryTests.cs @@ -18,11 +18,11 @@ namespace Umbraco.Tests { public override void Initialize() { - base.Initialize(); + //set the current umbraco context and a published content store + PublishedContentStoreResolver.Current = new PublishedContentStoreResolver( + new DefaultPublishedContentStore()); - //set the current umbraco context and a published content store - PublishedContentStoreResolver.Current = new PublishedContentStoreResolver( - new DefaultPublishedContentStore()); + base.Initialize(); var routingContext = GetRoutingContext("/test", 1234); UmbracoContext.Current = routingContext.UmbracoContext; diff --git a/src/Umbraco.Tests/Persistence/RepositoryResolverTests.cs b/src/Umbraco.Tests/Persistence/RepositoryResolverTests.cs index 2cab761302..3a612fbc93 100644 --- a/src/Umbraco.Tests/Persistence/RepositoryResolverTests.cs +++ b/src/Umbraco.Tests/Persistence/RepositoryResolverTests.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; +using Umbraco.Core.ObjectResolution; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.Persistence.UnitOfWork; @@ -19,6 +20,8 @@ namespace Umbraco.Tests.Persistence { RepositoryResolver.Current = new RepositoryResolver( new RepositoryFactory()); + + Resolution.Freeze(); } [TearDown] diff --git a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs index d2570dacfd..72da9dc875 100644 --- a/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs +++ b/src/Umbraco.Tests/PublishedContent/PublishedContentTests.cs @@ -66,29 +66,39 @@ namespace Umbraco.Tests.PublishedContent { base.Initialize(); - PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver( - new[] + //need to specify a custom callback for unit tests + PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) => + { + if (propertyAlias == "content") + { + //return the rte type id + return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83"); + } + return Guid.Empty; + }; + + var umbCtx = GetUmbracoContext("/test", 1234); + UmbracoContext.Current = umbCtx; + + } + + /// + /// Setup any resolvers before freezing + /// + protected override void OnFreezing() + { + base.OnFreezing(); + + PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore()); + + PropertyEditorValueConvertersResolver.Current = new PropertyEditorValueConvertersResolver( + new[] { typeof(DatePickerPropertyEditorValueConverter), typeof(TinyMcePropertyEditorValueConverter), typeof(YesNoPropertyEditorValueConverter) }); - - //need to specify a custom callback for unit tests - PublishedContentHelper.GetDataTypeCallback = (docTypeAlias, propertyAlias) => - { - if (propertyAlias == "content") - { - //return the rte type id - return Guid.Parse("5e9b75ae-face-41c8-b47e-5f4b0fd82f83"); - } - return Guid.Empty; - }; - - var umbCtx = GetUmbracoContext("/test", 1234); - UmbracoContext.Current = umbCtx; - PublishedContentStoreResolver.Current = new PublishedContentStoreResolver(new DefaultPublishedContentStore()); - } + } public override void TearDown() { diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 8c9b6c282a..1889bfe938 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -356,7 +356,9 @@ - + + ASPXCodeBehind + ASPXCodeBehind