mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 20:13:52 +08:00
- Fixing some broken tests (table prefix and extension manager refactoring side effects)...
--HG-- branch : dev
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using FluentNHibernate.Automapping;
|
using FluentNHibernate.Automapping;
|
||||||
using FluentNHibernate.Automapping.Alterations;
|
using FluentNHibernate.Automapping.Alterations;
|
||||||
using FluentNHibernate.Cfg;
|
using FluentNHibernate.Cfg;
|
||||||
@@ -10,7 +9,6 @@ using NHibernate;
|
|||||||
using NHibernate.Tool.hbm2ddl;
|
using NHibernate.Tool.hbm2ddl;
|
||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
using Orchard.Data.Builders;
|
using Orchard.Data.Builders;
|
||||||
using Orchard.Environment.Topology;
|
|
||||||
using Orchard.Environment.Topology.Models;
|
using Orchard.Environment.Topology.Models;
|
||||||
|
|
||||||
namespace Orchard.Tests {
|
namespace Orchard.Tests {
|
||||||
@@ -20,7 +18,7 @@ namespace Orchard.Tests {
|
|||||||
//var persistenceModel = AutoMap.Source(new Types(types))
|
//var persistenceModel = AutoMap.Source(new Types(types))
|
||||||
// .Alterations(alt => AddAlterations(alt, types))
|
// .Alterations(alt => AddAlterations(alt, types))
|
||||||
// .Conventions.AddFromAssemblyOf<DataModule>();
|
// .Conventions.AddFromAssemblyOf<DataModule>();
|
||||||
var persistenceModel = AbstractBuilder.CreatePersistenceModel(types.Select(t => new RecordTopology { TableName = "Test", Type = t }));
|
var persistenceModel = AbstractBuilder.CreatePersistenceModel(types.Select(t => new RecordTopology { TableName = "Test_" + t.Name,Type = t }));
|
||||||
|
|
||||||
return Fluently.Configure()
|
return Fluently.Configure()
|
||||||
.Database(SQLiteConfiguration.Standard.UsingFile(fileName).ShowSql())
|
.Database(SQLiteConfiguration.Standard.UsingFile(fileName).ShowSql())
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ features:
|
|||||||
Assert.That(descriptor.WebSite, Is.EqualTo("http://anotherwiki.codeplex.com"));
|
Assert.That(descriptor.WebSite, Is.EqualTo("http://anotherwiki.codeplex.com"));
|
||||||
Assert.That(descriptor.Version, Is.EqualTo("1.2.3"));
|
Assert.That(descriptor.Version, Is.EqualTo("1.2.3"));
|
||||||
Assert.That(descriptor.OrchardVersion, Is.EqualTo("1"));
|
Assert.That(descriptor.OrchardVersion, Is.EqualTo("1"));
|
||||||
Assert.That(descriptor.Features.Count(), Is.EqualTo(4));
|
Assert.That(descriptor.Features.Count(), Is.EqualTo(5));
|
||||||
foreach (var featureDescriptor in descriptor.Features) {
|
foreach (var featureDescriptor in descriptor.Features) {
|
||||||
switch (featureDescriptor.Name) {
|
switch (featureDescriptor.Name) {
|
||||||
case "AnotherWiki":
|
case "AnotherWiki":
|
||||||
@@ -187,6 +187,10 @@ features:
|
|||||||
Assert.That(featureDescriptor.Dependencies.Contains("AnotherWiki"));
|
Assert.That(featureDescriptor.Dependencies.Contains("AnotherWiki"));
|
||||||
Assert.That(featureDescriptor.Dependencies.Contains("reCaptcha"));
|
Assert.That(featureDescriptor.Dependencies.Contains("reCaptcha"));
|
||||||
break;
|
break;
|
||||||
|
// default feature.
|
||||||
|
case "MyCompany.AnotherWiki":
|
||||||
|
Assert.That(featureDescriptor.Extension, Is.SameAs(descriptor));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Assert.Fail("Features not parsed correctly");
|
Assert.Fail("Features not parsed correctly");
|
||||||
break;
|
break;
|
||||||
@@ -196,8 +200,25 @@ features:
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ExtensionManagerShouldLoadFeatures() {
|
public void ExtensionManagerShouldLoadFeatures() {
|
||||||
var descriptors = _manager.AvailableExtensions().SelectMany(x => x.Features);
|
var extensionLoader = new StubLoaders();
|
||||||
var features = _manager.LoadFeatures(descriptors);
|
var extensionFolder = new StubFolders();
|
||||||
|
|
||||||
|
extensionFolder.Manifests.Add("TestModule", @"
|
||||||
|
name: TestModule
|
||||||
|
version: 1.0.3
|
||||||
|
orchardversion: 1
|
||||||
|
features:
|
||||||
|
TestModule:
|
||||||
|
Description: My test module for Orchard.
|
||||||
|
TestFeature:
|
||||||
|
Description: Contains the Phi type.
|
||||||
|
");
|
||||||
|
|
||||||
|
ExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||||
|
var testFeature = extensionManager.AvailableExtensions()
|
||||||
|
.SelectMany(x => x.Features);
|
||||||
|
|
||||||
|
var features = extensionManager.LoadFeatures(testFeature);
|
||||||
var types = features.SelectMany(x => x.ExportedTypes);
|
var types = features.SelectMany(x => x.ExportedTypes);
|
||||||
|
|
||||||
Assert.That(types.Count(), Is.Not.EqualTo(0));
|
Assert.That(types.Count(), Is.Not.EqualTo(0));
|
||||||
@@ -205,8 +226,25 @@ features:
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void ExtensionManagerFeaturesContainNonAbstractClasses() {
|
public void ExtensionManagerFeaturesContainNonAbstractClasses() {
|
||||||
var descriptors = _manager.AvailableExtensions().SelectMany(x => x.Features);
|
var extensionLoader = new StubLoaders();
|
||||||
var features = _manager.LoadFeatures(descriptors);
|
var extensionFolder = new StubFolders();
|
||||||
|
|
||||||
|
extensionFolder.Manifests.Add("TestModule", @"
|
||||||
|
name: TestModule
|
||||||
|
version: 1.0.3
|
||||||
|
orchardversion: 1
|
||||||
|
features:
|
||||||
|
TestModule:
|
||||||
|
Description: My test module for Orchard.
|
||||||
|
TestFeature:
|
||||||
|
Description: Contains the Phi type.
|
||||||
|
");
|
||||||
|
|
||||||
|
ExtensionManager extensionManager = new ExtensionManager(new[] { extensionFolder }, new[] { extensionLoader });
|
||||||
|
var testFeature = extensionManager.AvailableExtensions()
|
||||||
|
.SelectMany(x => x.Features);
|
||||||
|
|
||||||
|
var features = extensionManager.LoadFeatures(testFeature);
|
||||||
var types = features.SelectMany(x => x.ExportedTypes);
|
var types = features.SelectMany(x => x.ExportedTypes);
|
||||||
|
|
||||||
foreach (var type in types) {
|
foreach (var type in types) {
|
||||||
|
|||||||
Reference in New Issue
Block a user