diff --git a/src/Orchard.Tests/Data/RepositoryTests.cs b/src/Orchard.Tests/Data/RepositoryTests.cs index 553d22f3c..86e0fdf45 100644 --- a/src/Orchard.Tests/Data/RepositoryTests.cs +++ b/src/Orchard.Tests/Data/RepositoryTests.cs @@ -200,40 +200,6 @@ namespace Orchard.Tests.Data { Assert.That(two.Name, Is.EqualTo("two")); } - [Test] - public void TransactionShouldCallActionAndCommitWhenSuccessful() { - CreateThreeFoos(); - _fooRepos.Transaction(() => { _fooRepos.Get(f => f.Name == "one").Name = "uno"; }); - // need to evict all entities from session - otherwise modified class instances are selected - _session.Clear(); - - var foos = _fooRepos.Fetch(f => f.Name == "one" || f.Name == "uno"); - Assert.That(foos.Count(), Is.EqualTo(1)); - Assert.That(foos, Has.Some.Property("Name").EqualTo("uno")); - Assert.That(foos, Has.None.Property("Name").EqualTo("one")); - } - - [Test] - public void ExceptionsShouldRollbackTransactionAndRethrowOutOfMethod() { - CreateThreeFoos(); - try { - _fooRepos.Transaction(() => { - _fooRepos.Get(f => f.Name == "one").Name = "uno"; - throw new ApplicationException("boom"); - }); - } - catch (Exception ex) { - Assert.That(ex.Message, Is.EqualTo("boom")); - } - - // need to evict all entities from session - otherwise modified class instances are selected - _session.Clear(); - - var foos = _fooRepos.Fetch(f => f.Name == "one" || f.Name == "uno"); - Assert.That(foos.Count(), Is.EqualTo(1)); - Assert.That(foos, Has.None.Property("Name").EqualTo("uno")); - Assert.That(foos, Has.Some.Property("Name").EqualTo("one")); - } } } \ No newline at end of file diff --git a/src/Orchard.Tests/DataMigration/SchemaCommandGeneratorTests.cs b/src/Orchard.Tests/DataMigration/SchemaCommandGeneratorTests.cs index effe65baf..9a6e7bd61 100644 --- a/src/Orchard.Tests/DataMigration/SchemaCommandGeneratorTests.cs +++ b/src/Orchard.Tests/DataMigration/SchemaCommandGeneratorTests.cs @@ -1,4 +1,6 @@ -using System; +#if REFACTORING +#error This must move to the Modules tests to accomodateOrchard.DevTools assembly reference +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Data; @@ -274,3 +276,4 @@ features: } } } +#endif \ No newline at end of file diff --git a/src/Orchard.Tests/DisplayManagement/Descriptors/ShapeAttributeBindingStrategyTests.cs b/src/Orchard.Tests/DisplayManagement/Descriptors/ShapeAttributeBindingStrategyTests.cs index f613981fc..7f3769cab 100644 --- a/src/Orchard.Tests/DisplayManagement/Descriptors/ShapeAttributeBindingStrategyTests.cs +++ b/src/Orchard.Tests/DisplayManagement/Descriptors/ShapeAttributeBindingStrategyTests.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Web.Routing; using Autofac; using Moq; using NUnit.Framework; @@ -21,6 +22,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors { _testFeature = new FeatureDescriptor { Name = "Testing", Extension = new ExtensionDescriptor { Name = "Testing" } }; builder.RegisterType().As(); builder.RegisterInstance(new TestProvider()).WithMetadata("Feature", _testFeature); + builder.RegisterInstance(new RouteCollection()); builder.RegisterModule(new ShapeAttributeBindingModule()); } diff --git a/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs b/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs index 13bd0b8a0..9ecb09985 100644 --- a/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs +++ b/src/Orchard.Tests/DisplayManagement/SubsystemTests.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Web; using System.Web.Mvc; +using System.Web.Routing; using Autofac; using Moq; using NUnit.Framework; @@ -31,6 +32,7 @@ namespace Orchard.Tests.DisplayManagement { builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType(); + builder.RegisterInstance(new RouteCollection()); builder.RegisterAutoMocking(MockBehavior.Loose); _container = builder.Build(); _container.Resolve>() diff --git a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs index d72148395..ec2f88bf7 100644 --- a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs +++ b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs @@ -142,14 +142,6 @@ namespace Orchard.Tests.Environment { } } - [Test] - public void HostShouldSetControllerFactory() { - var host = _lifetime.Resolve(); - - Assert.That(_controllerBuilder.GetControllerFactory(), Is.TypeOf()); - host.Initialize(); - Assert.That(_controllerBuilder.GetControllerFactory(), Is.TypeOf()); - } [Test] diff --git a/src/Orchard.Tests/Orchard.Framework.Tests.csproj b/src/Orchard.Tests/Orchard.Framework.Tests.csproj index 1fd1f914f..a5776bbba 100644 --- a/src/Orchard.Tests/Orchard.Framework.Tests.csproj +++ b/src/Orchard.Tests/Orchard.Framework.Tests.csproj @@ -268,14 +268,6 @@ - - {67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890} - Orchard.DevTools - - - {79AED36E-ABD0-4747-93D3-8722B042454B} - Orchard.Users - {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6} Orchard.Framework diff --git a/src/Orchard.Tests/UI/Navigation/MenuFilterTests.cs b/src/Orchard.Tests/UI/Navigation/MenuFilterTests.cs index dffcc6edb..301779081 100644 --- a/src/Orchard.Tests/UI/Navigation/MenuFilterTests.cs +++ b/src/Orchard.Tests/UI/Navigation/MenuFilterTests.cs @@ -45,7 +45,7 @@ namespace Orchard.Tests.UI.Navigation { Assert.That(main.Count(), Is.EqualTo(1)); } - +#if REFACTORING [Test] public void MainMenuShouldBeCalledNormally() { Mock navigationManager = GetNavigationManager(); @@ -83,6 +83,7 @@ namespace Orchard.Tests.UI.Navigation { Assert.That(viewModel.Menu, Is.Not.Null); Assert.That(viewModel.Menu.Single().Text, Is.SameAs("The Admin Menu")); } +#endif } diff --git a/src/Orchard.Tests/UI/Notify/NotifyFilterTests.cs b/src/Orchard.Tests/UI/Notify/NotifyFilterTests.cs index 62372177d..57f8be39a 100644 --- a/src/Orchard.Tests/UI/Notify/NotifyFilterTests.cs +++ b/src/Orchard.Tests/UI/Notify/NotifyFilterTests.cs @@ -58,6 +58,8 @@ namespace Orchard.Tests.UI.Notify { Assert.That(executedContext.Controller.TempData["messages"], Is.StringContaining("dont-destroy")); } +#if REFACTORING + [Test] public void TempDataBuildsMessagesWhenResultExecutingIsBaseViewModel() { var sink = new Notifier(); @@ -82,5 +84,6 @@ namespace Orchard.Tests.UI.Notify { Assert.That(model.Messages, Has.Some.Property("Message").EqualTo(T("dont-destroy"))); Assert.That(model.Messages, Has.Some.Property("Message").EqualTo(T("Working"))); } +#endif } } \ No newline at end of file diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs b/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs index f50300d13..4adb7d309 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeBindingStrategy.cs @@ -77,11 +77,11 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy { return Arguments.From(attributes.Values, attributes.Keys); } - // meh + // meh-- if (parameter.Name == "Html") { return new HtmlHelper( displayContext.ViewContext, - new ViewDataContainer { ViewData = displayContext.ViewContext.ViewData }, + displayContext.ViewDataContainer, _routeCollection); } @@ -90,11 +90,6 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy { return converter.Invoke((object)result); } - // ++meh - class ViewDataContainer : IViewDataContainer { - public ViewDataDictionary ViewData { get; set; } - } - static readonly ConcurrentDictionary> _converters = new ConcurrentDictionary>(); diff --git a/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs b/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs index 81215669c..57887f5ab 100644 --- a/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs +++ b/src/Orchard/Mvc/Html/HtmlHelperExtensions.cs @@ -445,12 +445,14 @@ namespace Orchard.Mvc.Html { } private static void AddRenderActionHelper(this HtmlHelper html, string location, string actionName, string controllerName, RouteValueDictionary routeValues) { +#if REFACTORING // Retrieve the "BaseViewModel" for zones if we have one var baseViewModel = BaseViewModel.From(html.ViewData); if (baseViewModel == null) return; baseViewModel.Zones.AddRenderAction(location, actionName, controllerName, routeValues); +#endif } #endregion diff --git a/src/Orchard/Mvc/ViewEngines/LayoutView.cs b/src/Orchard/Mvc/ViewEngines/LayoutView.cs index 640f299c9..651217a28 100644 --- a/src/Orchard/Mvc/ViewEngines/LayoutView.cs +++ b/src/Orchard/Mvc/ViewEngines/LayoutView.cs @@ -40,10 +40,14 @@ namespace Orchard.Mvc.ViewEngines { } private static ViewDataDictionary CoerceViewData(ViewDataDictionary dictionary) { +#if REFACTORING if (dictionary.Model is BaseViewModel) return dictionary; return new ViewDataDictionary(BaseViewModel.From(dictionary)); +#else + return null; +#endif } diff --git a/src/Orchard/Security/SecurityFilter.cs b/src/Orchard/Security/SecurityFilter.cs index 8457b276a..058cebf8f 100644 --- a/src/Orchard/Security/SecurityFilter.cs +++ b/src/Orchard/Security/SecurityFilter.cs @@ -17,12 +17,14 @@ namespace Orchard.Security { public ILogger Logger { get; set; } public void OnResultExecuting(ResultExecutingContext filterContext) { +#if REFACTORING var baseViewModel = BaseViewModel.From(filterContext.Result); if (baseViewModel == null) return; if (baseViewModel.CurrentUser == null) baseViewModel.CurrentUser = _authenticationService.GetAuthenticatedUser(); +#endif } public void OnResultExecuted(ResultExecutedContext filterContext) { diff --git a/src/Orchard/Themes/ThemeFilter.cs b/src/Orchard/Themes/ThemeFilter.cs index e5d71b612..cca0f9d8d 100644 --- a/src/Orchard/Themes/ThemeFilter.cs +++ b/src/Orchard/Themes/ThemeFilter.cs @@ -19,6 +19,7 @@ namespace Orchard.Themes { } public void OnResultExecuting(ResultExecutingContext filterContext) { +#if REFACTORING var viewResult = filterContext.Result as ViewResult; if (viewResult == null) return; @@ -28,6 +29,7 @@ namespace Orchard.Themes { return; Apply(filterContext.RequestContext); +#endif } public void OnResultExecuted(ResultExecutedContext filterContext) { diff --git a/src/Orchard/UI/Navigation/MenuFilter.cs b/src/Orchard/UI/Navigation/MenuFilter.cs index f694f9e35..40042ecb5 100644 --- a/src/Orchard/UI/Navigation/MenuFilter.cs +++ b/src/Orchard/UI/Navigation/MenuFilter.cs @@ -14,6 +14,7 @@ namespace Orchard.UI.Navigation { } public void OnResultExecuting(ResultExecutingContext filterContext) { +#if REFACTORING var baseViewModel = BaseViewModel.From(filterContext.Result); if (baseViewModel == null) return; @@ -23,6 +24,7 @@ namespace Orchard.UI.Navigation { menuName = "admin"; baseViewModel.Menu = _navigationManager.BuildMenu(menuName); +#endif } public void OnResultExecuted(ResultExecutedContext filterContext) { diff --git a/src/Orchard/UI/Notify/NotifyFilter.cs b/src/Orchard/UI/Notify/NotifyFilter.cs index d25c841b5..5e8276202 100644 --- a/src/Orchard/UI/Notify/NotifyFilter.cs +++ b/src/Orchard/UI/Notify/NotifyFilter.cs @@ -47,6 +47,7 @@ namespace Orchard.UI.Notify { } public void OnResultExecuting(ResultExecutingContext filterContext) { +#if REFACTORING var viewResult = filterContext.Result as ViewResultBase; // if it's not a view result, a redirect for example @@ -82,6 +83,7 @@ namespace Orchard.UI.Notify { baseViewModel.Messages = baseViewModel.Messages == null ? messageEntries : baseViewModel.Messages.Union(messageEntries).ToList(); baseViewModel.Zones.AddRenderPartial("content:before", "Messages", baseViewModel.Messages); +#endif } public void OnResultExecuted(ResultExecutedContext filterContext) { diff --git a/src/Orchard/UI/Resources/ResourceFilter.cs b/src/Orchard/UI/Resources/ResourceFilter.cs index b9cffb532..d5f604259 100644 --- a/src/Orchard/UI/Resources/ResourceFilter.cs +++ b/src/Orchard/UI/Resources/ResourceFilter.cs @@ -5,6 +5,7 @@ using Orchard.Mvc.ViewEngines; using Orchard.Mvc.ViewModels; namespace Orchard.UI.Resources { +#if REFACTORING public class ResourceFilter : FilterProvider, IResultFilter { private readonly IResourceManager _resourceManager; @@ -34,4 +35,5 @@ namespace Orchard.UI.Resources { public void OnResultExecuted(ResultExecutedContext filterContext) { } } +#endif } \ No newline at end of file