Build*Model -> Build*Shape (in process of changing to work with (Clay) shapes instead of ContentItemViewModel)

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-09-02 15:11:33 -07:00
parent 203b3e09c6
commit 33d47b3c39
36 changed files with 199 additions and 248 deletions

View File

@@ -103,7 +103,7 @@ namespace Orchard.Core.Tests.Common.Providers {
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);
contentManager.UpdateEditorShape(item.ContentItem, updateModel.Object);
}
class UpdatModelStub : IUpdateModel {
@@ -142,7 +142,7 @@ namespace Orchard.Core.Tests.Common.Providers {
var updater = new UpdatModelStub() { Owner = null };
contentManager.UpdateEditorModel(item.ContentItem, updater);
contentManager.UpdateEditorShape(item.ContentItem, updater);
}
[Test, Ignore("Fix pending")]
@@ -160,7 +160,7 @@ namespace Orchard.Core.Tests.Common.Providers {
var updater = new UpdatModelStub() {Owner = ""};
contentManager.UpdateEditorModel(item.ContentItem, updater);
contentManager.UpdateEditorShape(item.ContentItem, updater);
Assert.That(updater.ModelErrors.ContainsKey("CommonPart.Owner"), Is.True);
}

View File

@@ -58,7 +58,7 @@ namespace Orchard.Core.Tests.Routable.Services {
public void InvalidCharactersShouldBeReplacedByADash() {
var contentManager = _container.Resolve<IContentManager>();
var thing = contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
var thing = contentManager.Create<Thing>("thing", t => {
t.As<RoutePart>().Record = new RoutePartRecord();
t.Title = "Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"";
});
@@ -159,13 +159,13 @@ namespace Orchard.Core.Tests.Routable.Services {
private RoutePart CreateRoutePart(string title, string slug = "", string containerPath = "") {
var contentManager = _container.Resolve<IContentManager>();
return contentManager.Create<Thing>(ThingDriver.ContentType.Name, t => {
return contentManager.Create<Thing>("thing", t => {
t.As<RoutePart>().Record = new RoutePartRecord();
if (!string.IsNullOrWhiteSpace(slug))
t.As<RoutePart>().Slug = slug;
t.Title = title;
if (!string.IsNullOrWhiteSpace(containerPath)) {
t.As<ICommonPart>().Container = contentManager.Create<Thing>(ThingDriver.ContentType.Name, tt => {
t.As<ICommonPart>().Container = contentManager.Create<Thing>("thing", tt => {
tt.As<RoutePart>().Path = containerPath;
tt.As<RoutePart>().Slug = containerPath;
});
@@ -191,10 +191,10 @@ namespace Orchard.Core.Tests.Routable.Services {
[UsedImplicitly]
public class ThingHandler : ContentHandler {
public ThingHandler() {
Filters.Add(new ActivatingFilter<Thing>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<CommonPart>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<RoutePart>(ThingDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<Thing>("thing"));
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>("thing"));
Filters.Add(new ActivatingFilter<CommonPart>("thing"));
Filters.Add(new ActivatingFilter<RoutePart>("thing"));
}
}
@@ -212,20 +212,13 @@ namespace Orchard.Core.Tests.Routable.Services {
}
}
public class ThingDriver : ContentItemDriver<Thing> {
public readonly static ContentType ContentType = new ContentType {
Name = "thing",
DisplayName = "Thing"
};
}
[UsedImplicitly]
public class StuffHandler : ContentHandler {
public StuffHandler() {
Filters.Add(new ActivatingFilter<Stuff>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<CommonPart>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<RoutePart>(StuffDriver.ContentType.Name));
Filters.Add(new ActivatingFilter<Stuff>("stuff"));
Filters.Add(new ActivatingFilter<ContentPart<CommonPartVersionRecord>>("stuff"));
Filters.Add(new ActivatingFilter<CommonPart>("stuff"));
Filters.Add(new ActivatingFilter<RoutePart>("stuff"));
}
}
@@ -242,12 +235,5 @@ namespace Orchard.Core.Tests.Routable.Services {
set { this.As<RoutePart>().Slug = value; }
}
}
public class StuffDriver : ContentItemDriver<Stuff> {
public readonly static ContentType ContentType = new ContentType {
Name = "stuff",
DisplayName = "Stuff"
};
}
}
}