Unit testing ContentItem, ContentPart, ContentField

Topics: Writing modules
Oct 4, 2011 at 1:29 PM
Edited Oct 4, 2011 at 1:38 PM

Hi, this is the code from Orchard.Tests.Modules.CommentServiceTest

 

public class CommentedItem : ContentPart {
    }

    [UsedImplicitly]
    public class CommentedItemHandler : ContentHandler {
        public CommentedItemHandler() {
            Filters.Add(new ActivatingFilter<CommentedItem>("commentedItem"));
            Filters.Add(new ActivatingFilter<CommentPart>("commentedItem"));
            Filters.Add(new ActivatingFilter<CommonPart>("commentedItem"));
        }
    }

  
    public class CommentedItemDriver : ContentPartDriver<CommentedItem> {
        public static readonly string ContentTypeName = "commentedItem";
    }

    public class StubCommentValidator : ICommentValidator {
        public bool ValidateComment(CommentPart commentPart) {
            return true;
        }
    }
How can I add a ContentField to this content item (or any content item) so that you can unit test them. I can't find any examples in Orchard.Tests.Modules
Coordinator
Oct 4, 2011 at 8:25 PM

What about Orchard.Tests.ContentManagement.Drivers.FieldStorage?