mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Fix unit tests
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4046148
This commit is contained in:
@@ -61,12 +61,12 @@ namespace Orchard.Tests.ContentManagement {
|
||||
_session = _sessionFactory.OpenSession();
|
||||
builder.Register(new DefaultContentManagerTests.TestSessionLocator(_session)).As<ISessionLocator>();
|
||||
|
||||
_session.Delete("from GammaRecord");
|
||||
_session.Delete("from DeltaRecord");
|
||||
_session.Delete("from EpsilonRecord");
|
||||
_session.Delete("from ContentItemVersionRecord");
|
||||
_session.Delete("from ContentItemRecord");
|
||||
_session.Delete("from ContentTypeRecord");
|
||||
_session.Delete(string.Format("from {0}", typeof(GammaRecord).FullName));
|
||||
_session.Delete(string.Format("from {0}", typeof(DeltaRecord).FullName));
|
||||
_session.Delete(string.Format("from {0}", typeof(EpsilonRecord).FullName));
|
||||
_session.Delete(string.Format("from {0}", typeof(ContentItemVersionRecord).FullName));
|
||||
_session.Delete(string.Format("from {0}", typeof(ContentItemRecord).FullName));
|
||||
_session.Delete(string.Format("from {0}", typeof(ContentTypeRecord).FullName));
|
||||
_session.Flush();
|
||||
_session.Clear();
|
||||
|
||||
|
@@ -12,11 +12,13 @@ namespace Orchard.Tests.Environment {
|
||||
public void ExpectedRecordsShouldComeBack() {
|
||||
var extensionManager = new Moq.Mock<IExtensionManager>();
|
||||
extensionManager.Setup(x => x.ActiveExtensions()).Returns(new[] {
|
||||
new ExtensionEntry
|
||||
{ExportedTypes = new[] {typeof (GammaRecord), typeof (DeltaRecord), typeof (Delta)}}
|
||||
});
|
||||
new ExtensionEntry {
|
||||
Descriptor = new ExtensionDescriptor { Name = "Test" },
|
||||
ExportedTypes = new[] { typeof(GammaRecord), typeof(DeltaRecord), typeof(Delta) }
|
||||
}
|
||||
});
|
||||
var strategy = new DefaultCompositionStrategy(extensionManager.Object);
|
||||
var recordTypes = strategy.GetRecordDescriptors();
|
||||
var recordTypes = strategy.GetRecordDescriptors().Select(d => d.Type);
|
||||
|
||||
Assert.That(recordTypes.Count(), Is.Not.EqualTo(0));
|
||||
Assert.That(recordTypes, Has.Some.EqualTo(typeof(DeltaRecord)));
|
||||
|
@@ -15,7 +15,9 @@ namespace Orchard.Data.Conventions {
|
||||
public void Apply(IClassInstance instance) {
|
||||
var desc = _descriptors.Where(d => d.Type == instance.EntityType).SingleOrDefault();
|
||||
if (desc != null) {
|
||||
instance.Table(desc.Prefix + "_" + desc.Type.Name);
|
||||
if (!string.IsNullOrEmpty(desc.Prefix)) {
|
||||
instance.Table(desc.Prefix + "_" + desc.Type.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user