mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
Fixing tests
--HG-- branch : dev
This commit is contained in:
@@ -28,6 +28,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
|
||||
public override void Register(ContainerBuilder builder) {
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterType<TestHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<CommonAspectHandler>().As<IContentHandler>();
|
||||
|
||||
|
@@ -26,6 +26,8 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
|
||||
public override void Register(ContainerBuilder builder) {
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
|
||||
builder.RegisterType<ThingHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<StuffHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<RoutableService>().As<IRoutableService>();
|
||||
@@ -140,18 +142,15 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GeneratedSlugsShouldBeUniqueAmongContentType()
|
||||
{
|
||||
public void GeneratedSlugsShouldBeUniqueAmongContentType() {
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
|
||||
var thing1 = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t =>
|
||||
{
|
||||
var thing1 = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
|
||||
t.As<RoutableAspect>().Record = new RoutableRecord();
|
||||
t.Title = "This Is Some Interesting Title";
|
||||
});
|
||||
|
||||
var thing2 = contentManager.Create<Thing>(ThingDriver.ContentType.Name , t =>
|
||||
{
|
||||
var thing2 = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
|
||||
t.As<RoutableAspect>().Record = new RoutableRecord();
|
||||
t.Title = "This Is Some Interesting Title";
|
||||
});
|
||||
@@ -160,18 +159,15 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SlugsCanBeDuplicatedAccrossContentTypes()
|
||||
{
|
||||
public void SlugsCanBeDuplicatedAccrossContentTypes() {
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
|
||||
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t =>
|
||||
{
|
||||
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
|
||||
t.As<RoutableAspect>().Record = new RoutableRecord();
|
||||
t.Title = "This Is Some Interesting Title";
|
||||
});
|
||||
|
||||
var stuff = contentManager.Create<Stuff>(StuffDriver.ContentType.Name, s =>
|
||||
{
|
||||
var stuff = contentManager.Create<Stuff>(StuffDriver.ContentType.Name, s => {
|
||||
s.As<RoutableAspect>().Record = new RoutableRecord();
|
||||
s.Title = "This Is Some Interesting Title";
|
||||
});
|
||||
@@ -195,8 +191,7 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
|
||||
[UsedImplicitly]
|
||||
public class ThingHandler : ContentHandler {
|
||||
public ThingHandler()
|
||||
{
|
||||
public ThingHandler() {
|
||||
Filters.Add(new ActivatingFilter<Thing>(ThingDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonVersionRecord>>(ThingDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<CommonAspect>(ThingDriver.ContentType.Name));
|
||||
@@ -226,10 +221,8 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public class StuffHandler : ContentHandler
|
||||
{
|
||||
public StuffHandler()
|
||||
{
|
||||
public class StuffHandler : ContentHandler {
|
||||
public StuffHandler() {
|
||||
Filters.Add(new ActivatingFilter<Stuff>(StuffDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonVersionRecord>>(StuffDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<CommonAspect>(StuffDriver.ContentType.Name));
|
||||
@@ -237,27 +230,22 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
}
|
||||
}
|
||||
|
||||
public class Stuff : ContentPart
|
||||
{
|
||||
public class Stuff : ContentPart {
|
||||
public int Id { get { return ContentItem.Id; } }
|
||||
|
||||
public string Title
|
||||
{
|
||||
public string Title {
|
||||
get { return this.As<RoutableAspect>().Title; }
|
||||
set { this.As<RoutableAspect>().Title = value; }
|
||||
}
|
||||
|
||||
public string Slug
|
||||
{
|
||||
public string Slug {
|
||||
get { return this.As<RoutableAspect>().Slug; }
|
||||
set { this.As<RoutableAspect>().Slug = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public class StuffDriver : ContentItemDriver<Stuff>
|
||||
{
|
||||
public readonly static ContentType ContentType = new ContentType
|
||||
{
|
||||
public class StuffDriver : ContentItemDriver<Stuff> {
|
||||
public readonly static ContentType ContentType = new ContentType {
|
||||
Name = "stuff",
|
||||
DisplayName = "Stuff"
|
||||
};
|
||||
|
@@ -28,7 +28,9 @@ namespace Orchard.Core.Tests.Scheduling {
|
||||
_handler = new StubTaskHandler();
|
||||
builder.RegisterInstance(new Mock<IOrchardServices>().Object);
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<ScheduledTaskExecutor>().As<IBackgroundTask>().Named("ScheduledTaskExecutor", typeof (IBackgroundTask));
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
|
||||
builder.RegisterType<ScheduledTaskExecutor>().As<IBackgroundTask>().Named("ScheduledTaskExecutor", typeof(IBackgroundTask));
|
||||
builder.RegisterInstance(_handler).As<IScheduledTaskHandler>();
|
||||
}
|
||||
|
||||
|
@@ -26,12 +26,14 @@ namespace Orchard.Core.Tests.Scheduling {
|
||||
_repository = _container.Resolve<IRepository<ScheduledTaskRecord>>();
|
||||
_scheduledTaskManager = _container.Resolve<IScheduledTaskManager>();
|
||||
_contentManager = _container.Resolve<IContentManager>();
|
||||
_mockServices.SetupGet(x=>x.ContentManager).Returns(_contentManager);
|
||||
_mockServices.SetupGet(x => x.ContentManager).Returns(_contentManager);
|
||||
}
|
||||
|
||||
public override void Register(ContainerBuilder builder) {
|
||||
builder.RegisterInstance(_mockServices.Object);
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
|
||||
builder.RegisterType<ScheduledTaskManager>().As<IScheduledTaskManager>();
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,8 @@ namespace Orchard.Tests.ContentManagement {
|
||||
// builder.RegisterModule(new ImplicitCollectionSupportModule());
|
||||
builder.RegisterModule(new ContentModule());
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>().SingleInstance();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
|
||||
builder.RegisterType<AlphaHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<BetaHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<GammaHandler>().As<IContentHandler>();
|
||||
|
@@ -42,6 +42,8 @@ namespace Orchard.Tests.ContentManagement {
|
||||
var builder = new ContainerBuilder();
|
||||
//builder.RegisterModule(new ImplicitCollectionSupportModule());
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
|
||||
builder.RegisterType<AlphaHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<BetaHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<GammaHandler>().As<IContentHandler>();
|
||||
|
@@ -63,14 +63,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "Orchard.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Profile", "Orchard.Profile\Orchard.Profile.csproj", "{94E694A2-D140-468D-A277-C5FCE1D13E9B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure", "Azure", "{55E8934A-9C5B-4647-8DE0-50E48B423339}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure", "Orchard.Azure\Orchard.Azure.csproj", "{2505AA84-65A6-43D0-9C27-4F44FD576284}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Web", "Orchard.Azure\Orchard.Azure.Web\Orchard.Azure.Web.csproj", "{0DF8F426-9F30-4918-8F64-A5B40BA12D10}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Tests", "Orchard.Azure.Tests\Orchard.Azure.Tests.csproj", "{1CC62F45-E6FF-43D5-84BF-509A1085D994}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -185,18 +177,6 @@ Global
|
||||
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -226,8 +206,5 @@ Global
|
||||
{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56} = {383DBA32-4A3E-48D1-AAC3-75377A694452}
|
||||
{33B1BC8D-E292-4972-A363-22056B207156} = {383DBA32-4A3E-48D1-AAC3-75377A694452}
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6} = {E75A4CE4-CAA6-41E4-B951-33ACC60DC77C}
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284} = {55E8934A-9C5B-4647-8DE0-50E48B423339}
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10} = {55E8934A-9C5B-4647-8DE0-50E48B423339}
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994} = {55E8934A-9C5B-4647-8DE0-50E48B423339}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
Reference in New Issue
Block a user