Refactoring comments to be able to use SpamFilter

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-11-07 16:31:36 -08:00
parent 37f0fbd41e
commit 19a22c6473
53 changed files with 386 additions and 409 deletions

View File

@@ -32,7 +32,6 @@ namespace Orchard.Tests.Modules.Comments.Services {
public override void Register(ContainerBuilder builder) {
builder.RegisterType<CommentService>().As<ICommentService>();
builder.RegisterType<StubCommentValidator>().As<ICommentValidator>();
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
builder.RegisterInstance(new Mock<IContentDefinitionManager>().Object);
@@ -141,21 +140,6 @@ namespace Orchard.Tests.Modules.Comments.Services {
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Pending));
}
[Test]
public void MarkAsSpamShouldFlagComments() {
var commentedItem = _contentManager.New("commentedItem");
_contentManager.Create(commentedItem);
_contentManager.Create(commentedItem, VersionOptions.Published);
int commentId = commentedItem.As<CommentPart>().Id;
_commentService.ApproveComment(commentId);
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Approved));
_commentService.MarkCommentAsSpam(commentId);
Assert.That(_commentService.GetComment(commentId).Record.Status, Is.EqualTo(CommentStatus.Spam));
}
[Test]
public void DeleteShouldRemoveComments() {
var commentIds = new int[12];
@@ -194,10 +178,4 @@ namespace Orchard.Tests.Modules.Comments.Services {
public class CommentedItemDriver : ContentPartDriver<CommentedItem> {
public static readonly string ContentTypeName = "commentedItem";
}
public class StubCommentValidator : ICommentValidator {
public bool ValidateComment(CommentPart commentPart) {
return true;
}
}
}

View File

@@ -32,7 +32,7 @@
<Settings>
<SiteSettingsPart PageSize="30" />
<CommentSettingsPart enableSpamProtection="true" />
<CommentSettingsPart />
</Settings>
<Migration features="f2,f4"/>