Fix unit tests

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4046148
This commit is contained in:
rpaquay
2010-01-31 19:29:16 +00:00
parent 8f7b18ed8d
commit 8e6c3fc0bd
3 changed files with 15 additions and 11 deletions

View File

@@ -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();

View File

@@ -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)));

View File

@@ -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);
}
}
}
}