mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:16:18 +08:00
Fixing unit tests
--HG-- branch : dev
This commit is contained in:
@@ -9,12 +9,14 @@ using Orchard.Commands;
|
||||
using Orchard.Data;
|
||||
using Orchard.Data.Migration.Generator;
|
||||
using Orchard.Data.Providers;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.ShellBuilders;
|
||||
using Orchard.Environment.ShellBuilders.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Tests.Environment;
|
||||
using Orchard.Tests.FileSystems.AppData;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
@@ -49,6 +51,7 @@ namespace Orchard.Tests.Modules.CodeGeneration.Commands {
|
||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||
builder.RegisterType<SchemaCommandGenerator>().As<ISchemaCommandGenerator>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<StubHostEnvironment>().As<IHostEnvironment>();
|
||||
|
||||
_container = builder.Build();
|
||||
_extensionManager = _container.Resolve<IExtensionManager>();
|
||||
|
@@ -32,6 +32,8 @@ using Orchard.Tests.FileSystems.AppData;
|
||||
using Orchard.Tests.Modules.Migrations.Orchard.Tests.DataMigration.Records;
|
||||
using Path = Bleroy.FluentPath.Path;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Tests.Environment;
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Tests.Modules.Migrations {
|
||||
[TestFixture]
|
||||
@@ -85,6 +87,7 @@ namespace Orchard.Tests.Modules.Migrations {
|
||||
builder.RegisterType<SchemaCommandGenerator>().As<ISchemaCommandGenerator>();
|
||||
builder.RegisterGeneric(typeof(Repository<>)).As(typeof(IRepository<>));
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<StubHostEnvironment>().As<IHostEnvironment>();
|
||||
|
||||
_session = _sessionFactory.OpenSession();
|
||||
builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
|
||||
|
@@ -8,12 +8,14 @@ using Orchard.Data;
|
||||
using Orchard.Data.Migration.Interpreters;
|
||||
using Orchard.Data.Migration.Schema;
|
||||
using Orchard.Data.Providers;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.ShellBuilders.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Reports.Services;
|
||||
using Orchard.Tests.ContentManagement;
|
||||
using System.IO;
|
||||
using Orchard.Tests.Environment;
|
||||
using Orchard.Tests.FileSystems.AppData;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
@@ -47,6 +49,7 @@ namespace Orchard.Tests.DataMigration {
|
||||
builder.RegisterType<DefaultDataMigrationInterpreter>().As<IDataMigrationInterpreter>();
|
||||
builder.RegisterType<SessionConfigurationCache>().As<ISessionConfigurationCache>();
|
||||
builder.RegisterType<SessionFactoryHolder>().As<ISessionFactoryHolder>();
|
||||
builder.RegisterType<StubHostEnvironment>().As<IHostEnvironment>();
|
||||
builder.RegisterInstance(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
|
||||
builder.RegisterInstance(new ShellBlueprint { Records = Enumerable.Empty<RecordBlueprint>() }).As<ShellBlueprint>();
|
||||
builder.RegisterInstance(new ShellSettings { Name = "temp", DataProvider = "SqlCe", DataTablePrefix = "TEST" }).As<ShellSettings>();
|
||||
|
9
src/Orchard.Tests/Environment/StubHostEnvironment.cs
Normal file
9
src/Orchard.Tests/Environment/StubHostEnvironment.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using Orchard.Environment;
|
||||
|
||||
namespace Orchard.Tests.Environment {
|
||||
public class StubHostEnvironment : HostEnvironment {
|
||||
public override void ResetSiteCompilation() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Tests.Environment;
|
||||
|
||||
namespace Orchard.Tests.Logging {
|
||||
[TestFixture]
|
||||
@@ -13,6 +15,7 @@ namespace Orchard.Tests.Logging {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterModule(new LoggingModule());
|
||||
builder.RegisterType<Thing>();
|
||||
builder.RegisterType<StubHostEnvironment>().As<IHostEnvironment>();
|
||||
var container = builder.Build();
|
||||
var thing = container.Resolve<Thing>();
|
||||
Assert.That(thing.Logger, Is.Not.Null);
|
||||
@@ -46,6 +49,7 @@ namespace Orchard.Tests.Logging {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterModule(new LoggingModule());
|
||||
builder.RegisterType<Thing>();
|
||||
builder.RegisterType<StubHostEnvironment>().As<IHostEnvironment>();
|
||||
var container = builder.Build();
|
||||
var thing = container.Resolve<Thing>();
|
||||
Assert.That(thing.Logger, Is.Not.Null);
|
||||
|
@@ -226,6 +226,7 @@
|
||||
<Compile Include="Environment\Extensions\ExtensionLoaderCoordinatorTests.cs" />
|
||||
<Compile Include="Environment\State\DefaultProcessingEngineTests.cs" />
|
||||
<Compile Include="Environment\RunningShellTableTests.cs" />
|
||||
<Compile Include="Environment\StubHostEnvironment.cs" />
|
||||
<Compile Include="Environment\Utility\Build.cs" />
|
||||
<Compile Include="FileSystems\AppData\AppDataFolderTests.cs" />
|
||||
<Compile Include="Environment\Configuration\DefaultTenantManagerTests.cs" />
|
||||
|
Reference in New Issue
Block a user