mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
BodyAspect -> BodyPart; CommonAspect -> CommonPart
- updating part names to conform to a <name>Part convention --HG-- branch : dev rename : src/Orchard.Core.Tests/Common/Providers/CommonAspectProviderTests.cs => src/Orchard.Core.Tests/Common/Providers/CommonPartProviderTests.cs rename : src/Orchard.Web/Core/Common/Drivers/BodyDriver.cs => src/Orchard.Web/Core/Common/Drivers/BodyPartDriver.cs rename : src/Orchard.Web/Core/Common/Drivers/CommonDriver.cs => src/Orchard.Web/Core/Common/Drivers/CommonPartDriver.cs rename : src/Orchard.Web/Core/Common/Handlers/BodyAspectHandler.cs => src/Orchard.Web/Core/Common/Handlers/BodyPartHandler.cs rename : src/Orchard.Web/Core/Common/Handlers/CommonAspectHandler.cs => src/Orchard.Web/Core/Common/Handlers/CommonPartHandler.cs rename : src/Orchard.Web/Core/Common/Models/BodyAspect.cs => src/Orchard.Web/Core/Common/Models/BodyPart.cs rename : src/Orchard.Web/Core/Common/Models/BodyRecord.cs => src/Orchard.Web/Core/Common/Models/BodyPartRecord.cs rename : src/Orchard.Web/Core/Common/Models/CommonAspect.cs => src/Orchard.Web/Core/Common/Models/CommonPart.cs rename : src/Orchard.Web/Core/Common/Models/CommonRecord.cs => src/Orchard.Web/Core/Common/Models/CommonPartRecord.cs rename : src/Orchard.Web/Core/Common/Models/CommonVersionRecord.cs => src/Orchard.Web/Core/Common/Models/CommonPartVersionRecord.cs rename : src/Orchard/ContentManagement/Aspects/ICommonAspect.cs => src/Orchard/ContentManagement/Aspects/ICommonPart.cs
This commit is contained in:
@@ -25,7 +25,7 @@ using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Core.Tests.Common.Providers {
|
||||
[TestFixture]
|
||||
public class CommonAspectProviderTests : DatabaseEnabledTestsBase {
|
||||
public class CommonPartProviderTests : DatabaseEnabledTestsBase {
|
||||
private Mock<IAuthenticationService> _authn;
|
||||
private Mock<IAuthorizationService> _authz;
|
||||
private Mock<IMembershipService> _membership;
|
||||
@@ -35,7 +35,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterType<TestHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<CommonAspectHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<CommonPartHandler>().As<IContentHandler>();
|
||||
builder.RegisterType<CommonService>().As<ICommonService>();
|
||||
builder.RegisterType<PublishingTaskManager>().As<IPublishingTaskManager>();
|
||||
builder.RegisterType<ScheduledTaskManager>().As<IScheduledTaskManager>();
|
||||
@@ -57,8 +57,8 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
typeof(ContentTypeRecord),
|
||||
typeof(ContentItemRecord),
|
||||
typeof(ContentItemVersionRecord),
|
||||
typeof(CommonRecord),
|
||||
typeof(CommonVersionRecord),
|
||||
typeof(CommonPartRecord),
|
||||
typeof(CommonPartVersionRecord),
|
||||
typeof(ScheduledTaskRecord),
|
||||
};
|
||||
}
|
||||
@@ -67,8 +67,8 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
[UsedImplicitly]
|
||||
class TestHandler : ContentHandler {
|
||||
public TestHandler() {
|
||||
Filters.Add(new ActivatingFilter<CommonAspect>("test-item"));
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonVersionRecord>>("test-item"));
|
||||
Filters.Add(new ActivatingFilter<CommonPart>("test-item"));
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>("test-item"));
|
||||
Filters.Add(new ActivatingFilter<TestUser>("User"));
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
[Test]
|
||||
public void OwnerShouldBeNullAndZeroByDefault() {
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
var item = contentManager.Create<CommonAspect>("test-item", init => { });
|
||||
var item = contentManager.Create<CommonPart>("test-item", init => { });
|
||||
ClearSession();
|
||||
|
||||
Assert.That(item.Owner, Is.Null);
|
||||
@@ -99,7 +99,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
|
||||
|
||||
var createUtc = _clock.UtcNow;
|
||||
var item = contentManager.Create<ICommonAspect>("test-item", VersionOptions.Draft, init => { });
|
||||
var item = contentManager.Create<ICommonPart>("test-item", VersionOptions.Draft, init => { });
|
||||
var viewModel = new OwnerEditorViewModel() { Owner = "User" };
|
||||
updateModel.Setup(x => x.TryUpdateModel(viewModel, "", null, null)).Returns(true);
|
||||
contentManager.UpdateEditorModel(item.ContentItem, updateModel.Object);
|
||||
@@ -131,7 +131,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
{
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
|
||||
var item = contentManager.Create<ICommonAspect>("test-item", VersionOptions.Draft, init => { });
|
||||
var item = contentManager.Create<ICommonPart>("test-item", VersionOptions.Draft, init => { });
|
||||
|
||||
var user = contentManager.New<IUser>("User");
|
||||
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
|
||||
@@ -149,7 +149,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
{
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
|
||||
var item = contentManager.Create<ICommonAspect>("test-item", VersionOptions.Draft, init => { });
|
||||
var item = contentManager.Create<ICommonPart>("test-item", VersionOptions.Draft, init => { });
|
||||
|
||||
var user = contentManager.New<IUser>("User");
|
||||
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
|
||||
@@ -161,7 +161,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
|
||||
contentManager.UpdateEditorModel(item.ContentItem, updater);
|
||||
|
||||
Assert.That(updater.ModelErrors.ContainsKey("CommonAspect.Owner"), Is.True);
|
||||
Assert.That(updater.ModelErrors.ContainsKey("CommonPart.Owner"), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -170,7 +170,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
|
||||
var createUtc = _clock.UtcNow;
|
||||
var item = contentManager.Create<ICommonAspect>("test-item", VersionOptions.Draft, init => { });
|
||||
var item = contentManager.Create<ICommonPart>("test-item", VersionOptions.Draft, init => { });
|
||||
|
||||
Assert.That(item.CreatedUtc, Is.EqualTo(createUtc));
|
||||
Assert.That(item.PublishedUtc, Is.Null);
|
||||
@@ -190,7 +190,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
|
||||
var createUtc = _clock.UtcNow;
|
||||
var item1 = contentManager.Create<ICommonAspect>("test-item", VersionOptions.Draft, init => { });
|
||||
var item1 = contentManager.Create<ICommonPart>("test-item", VersionOptions.Draft, init => { });
|
||||
|
||||
Assert.That(item1.CreatedUtc, Is.EqualTo(createUtc));
|
||||
Assert.That(item1.PublishedUtc, Is.Null);
|
||||
@@ -204,7 +204,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
|
||||
_clock.Advance(TimeSpan.FromMinutes(1));
|
||||
var draftUtc = _clock.UtcNow;
|
||||
var item2 = contentManager.GetDraftRequired<ICommonAspect>(item1.ContentItem.Id);
|
||||
var item2 = contentManager.GetDraftRequired<ICommonPart>(item1.ContentItem.Id);
|
||||
|
||||
_clock.Advance(TimeSpan.FromMinutes(1));
|
||||
var publish2Utc = _clock.UtcNow;
|
||||
@@ -232,7 +232,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
var contentManager = _container.Resolve<IContentManager>();
|
||||
|
||||
var createUtc = _clock.UtcNow;
|
||||
var item = contentManager.Create<ICommonAspect>("test-item", VersionOptions.Draft, init => { });
|
||||
var item = contentManager.Create<ICommonPart>("test-item", VersionOptions.Draft, init => { });
|
||||
|
||||
Assert.That(item.CreatedUtc, Is.EqualTo(createUtc));
|
||||
Assert.That(item.PublishedUtc, Is.Null);
|
||||
@@ -252,9 +252,9 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
_session.Flush();
|
||||
_session.Clear();
|
||||
|
||||
var publishedItem = contentManager.Get<ICommonAspect>(item.ContentItem.Id, VersionOptions.Published);
|
||||
var latestItem = contentManager.Get<ICommonAspect>(item.ContentItem.Id, VersionOptions.Latest);
|
||||
var draftItem = contentManager.Get<ICommonAspect>(item.ContentItem.Id, VersionOptions.Draft);
|
||||
var publishedItem = contentManager.Get<ICommonPart>(item.ContentItem.Id, VersionOptions.Published);
|
||||
var latestItem = contentManager.Get<ICommonPart>(item.ContentItem.Id, VersionOptions.Latest);
|
||||
var draftItem = contentManager.Get<ICommonPart>(item.ContentItem.Id, VersionOptions.Draft);
|
||||
var allVersions = contentManager.GetAllVersions(item.ContentItem.Id);
|
||||
|
||||
Assert.That(publishedItem, Is.Null);
|
||||
@@ -189,8 +189,8 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
typeof(ContentTypeRecord),
|
||||
typeof(ContentItemRecord),
|
||||
typeof(ContentItemVersionRecord),
|
||||
typeof(CommonRecord),
|
||||
typeof(CommonVersionRecord),
|
||||
typeof(CommonPartRecord),
|
||||
typeof(CommonPartVersionRecord),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -199,8 +199,8 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
public class ThingHandler : ContentHandler {
|
||||
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));
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>(ThingDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<CommonPart>(ThingDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<IsRoutable>(ThingDriver.ContentType.Name));
|
||||
}
|
||||
}
|
||||
@@ -230,8 +230,8 @@ namespace Orchard.Core.Tests.Common.Services {
|
||||
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));
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>(StuffDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<CommonPart>(StuffDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<IsRoutable>(StuffDriver.ContentType.Name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,18 +148,18 @@ namespace Orchard.Core.Tests.Feeds.Controllers {
|
||||
public void CorePartValuesAreExtracted() {
|
||||
var clock = new StubClock();
|
||||
var hello = new ContentItemBuilder(new ContentTypeDefinitionBuilder().Named("hello").Build())
|
||||
.Weld<CommonAspect>()
|
||||
.Weld<CommonPart>()
|
||||
.Weld<IsRoutable>()
|
||||
.Weld<BodyAspect>()
|
||||
.Weld<BodyPart>()
|
||||
.Build();
|
||||
hello.As<CommonAspect>().Record = new CommonRecord();
|
||||
hello.As<CommonPart>().Record = new CommonPartRecord();
|
||||
hello.As<IsRoutable>().Record = new RoutableRecord();
|
||||
hello.As<BodyAspect>().Record = new BodyRecord();
|
||||
hello.As<BodyPart>().Record = new BodyPartRecord();
|
||||
|
||||
hello.As<CommonAspect>().PublishedUtc = clock.UtcNow;
|
||||
hello.As<CommonPart>().PublishedUtc = clock.UtcNow;
|
||||
hello.As<IsRoutable>().Title = "alpha";
|
||||
hello.As<IsRoutable>().Slug = "beta";
|
||||
hello.As<BodyAspect>().Text = "gamma";
|
||||
hello.As<BodyPart>().Text = "gamma";
|
||||
|
||||
var query = new StubQuery(new[] {
|
||||
hello,
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Common\Providers\CommonAspectProviderTests.cs" />
|
||||
<Compile Include="Common\Providers\CommonPartProviderTests.cs" />
|
||||
<Compile Include="Common\Services\RoutableServiceTests.cs" />
|
||||
<Compile Include="Feeds\Controllers\FeedControllerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
Reference in New Issue
Block a user