mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Refactoring comments to be able to use SpamFilter
--HG-- branch : 1.x
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
<Settings>
|
||||
<SiteSettingsPart PageSize="30" />
|
||||
<CommentSettingsPart enableSpamProtection="true" />
|
||||
<CommentSettingsPart />
|
||||
</Settings>
|
||||
|
||||
<Migration features="f2,f4"/>
|
||||
|
||||
Reference in New Issue
Block a user