mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Fixing unit tests
--HG-- branch : 1.x
This commit is contained in:
@@ -22,6 +22,7 @@ using Orchard.Mvc.Routes;
|
|||||||
using Orchard.Tests.Environment.TestDependencies;
|
using Orchard.Tests.Environment.TestDependencies;
|
||||||
using Orchard.Tests.Stubs;
|
using Orchard.Tests.Stubs;
|
||||||
using Orchard.Tests.Utility;
|
using Orchard.Tests.Utility;
|
||||||
|
using Orchard.WebApi.Routes;
|
||||||
using IModelBinderProvider = Orchard.Mvc.ModelBinders.IModelBinderProvider;
|
using IModelBinderProvider = Orchard.Mvc.ModelBinders.IModelBinderProvider;
|
||||||
|
|
||||||
namespace Orchard.Tests.Environment {
|
namespace Orchard.Tests.Environment {
|
||||||
@@ -60,6 +61,7 @@ namespace Orchard.Tests.Environment {
|
|||||||
builder.RegisterAutoMocking()
|
builder.RegisterAutoMocking()
|
||||||
.Ignore<IExtensionFolders>()
|
.Ignore<IExtensionFolders>()
|
||||||
.Ignore<IRouteProvider>()
|
.Ignore<IRouteProvider>()
|
||||||
|
.Ignore<IHttpRouteProvider>()
|
||||||
.Ignore<IModelBinderProvider>();
|
.Ignore<IModelBinderProvider>();
|
||||||
});
|
});
|
||||||
_lifetime = _container.BeginLifetimeScope();
|
_lifetime = _container.BeginLifetimeScope();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Web.Http.Controllers;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using Autofac.Core;
|
using Autofac.Core;
|
||||||
@@ -36,7 +37,8 @@ namespace Orchard.Tests.Environment.ShellBuilders {
|
|||||||
ShellBlueprint CreateBlueprint(params ShellBlueprintItem[] items) {
|
ShellBlueprint CreateBlueprint(params ShellBlueprintItem[] items) {
|
||||||
return new ShellBlueprint {
|
return new ShellBlueprint {
|
||||||
Dependencies = items.OfType<DependencyBlueprint>(),
|
Dependencies = items.OfType<DependencyBlueprint>(),
|
||||||
Controllers = items.OfType<ControllerBlueprint>(),
|
Controllers = items.OfType<ControllerBlueprint>().Where(bp => typeof(IController).IsAssignableFrom(bp.Type)),
|
||||||
|
HttpControllers = items.OfType<ControllerBlueprint>().Where(bp => typeof(IHttpController).IsAssignableFrom(bp.Type)),
|
||||||
Records = items.OfType<RecordBlueprint>(),
|
Records = items.OfType<RecordBlueprint>(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,9 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\moq\Moq.dll</HintPath>
|
<HintPath>..\..\lib\moq\Moq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json">
|
||||||
|
<HintPath>..\..\lib\newtonsoft.json\Newtonsoft.Json.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
<Reference Include="NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\nhibernate\NHibernate.dll</HintPath>
|
<HintPath>..\..\lib\nhibernate\NHibernate.dll</HintPath>
|
||||||
@@ -134,6 +137,7 @@
|
|||||||
<Reference Include="System.Web.Abstractions">
|
<Reference Include="System.Web.Abstractions">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
<HintPath>..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using System;
|
using System;
|
||||||
using Orchard.Environment;
|
using Orchard.Environment;
|
||||||
@@ -41,8 +42,15 @@ namespace Orchard.Tests.Storage {
|
|||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public void Term() {
|
public void Term() {
|
||||||
|
try {
|
||||||
Directory.Delete(_folderPath, true);
|
Directory.Delete(_folderPath, true);
|
||||||
}
|
}
|
||||||
|
catch (IOException) {
|
||||||
|
// if a system handle is still active give some time to release it
|
||||||
|
Thread.Sleep(0);
|
||||||
|
Directory.Delete(_folderPath, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private string _filePath;
|
private string _filePath;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.ServiceModel.Activation;
|
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Orchard.Environment;
|
using Orchard.Environment;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using System.Web.Http.WebHost.Routing;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using System.Web.SessionState;
|
using System.Web.SessionState;
|
||||||
@@ -49,8 +50,12 @@ namespace Orchard.Mvc.Routes {
|
|||||||
|
|
||||||
// otherwise wrap handler and return it
|
// otherwise wrap handler and return it
|
||||||
routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler);
|
routeData.RouteHandler = new RouteHandler(_workContextAccessor, routeData.RouteHandler);
|
||||||
routeData.Values["IWorkContextAccessor"] = _workContextAccessor; // for WebApi
|
|
||||||
routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;
|
routeData.DataTokens["IWorkContextAccessor"] = _workContextAccessor;
|
||||||
|
|
||||||
|
if (_route is HttpWebRoute) {
|
||||||
|
routeData.Values["IWorkContextAccessor"] = _workContextAccessor; // for WebApi
|
||||||
|
}
|
||||||
|
|
||||||
return routeData;
|
return routeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Orchard.WebApi {
|
|||||||
// Service name pattern matches the identification strategy
|
// Service name pattern matches the identification strategy
|
||||||
var serviceKey = (areaName + "/" + controllerName).ToLowerInvariant();
|
var serviceKey = (areaName + "/" + controllerName).ToLowerInvariant();
|
||||||
|
|
||||||
HttpControllerContext controllerContext = new HttpControllerContext(_configuration, routeData, request);
|
var controllerContext = new HttpControllerContext(_configuration, routeData, request);
|
||||||
|
|
||||||
// Now that the request container is known - try to resolve the controller information
|
// Now that the request container is known - try to resolve the controller information
|
||||||
Meta<Lazy<IHttpController>> info;
|
Meta<Lazy<IHttpController>> info;
|
||||||
|
|||||||
Reference in New Issue
Block a user