public override void Given() { _postId = Guid.NewGuid(); var postCreatedEvent = new PostCreatedEvent("Title", "Content", "slug", new List<string>() { "tag1", "tag2" }, "Excerpt", DateTime.Now.AddDays(-1), _postId); PostView.Handle(postCreatedEvent); AddXPostItemsToView(5, PostView); }
private Post(string title, string content, string slug, List<string> tags, string excerpt, Guid aggregateId) : this() { var creationDate = DateTime.Now; var createEvent = new PostCreatedEvent(title, content, slug, tags, excerpt, creationDate, aggregateId); Apply(createEvent); }
protected void AddXPostItemsToView(int numberOfItems, PostView postView) { for (int i = 0; i < numberOfItems; i++) { var postCreatedEvent = new PostCreatedEvent("Title", "Content", "slug", new List<string>() {"tag1", "tag2"}, "Excerpt", DateTime.Now.AddDays(-1), Guid.NewGuid()); postView.Handle(postCreatedEvent); } }
private void PostCreated(PostCreatedEvent postCreatedEventCreatedEvent) { AggregateId = postCreatedEventCreatedEvent.AggregateId; _title = postCreatedEventCreatedEvent.Title; _slug = postCreatedEventCreatedEvent.Slug; _tags = postCreatedEventCreatedEvent.Tags; _excerpt = postCreatedEventCreatedEvent.Excerpt; _content = postCreatedEventCreatedEvent.Content; _published = false; }
public override void When() { _postCreatedEvent = new PostCreatedEvent("Title", "Content", "slug", new List<string>() {"tag1", "tag2"}, "Excerpt", DateTime.Now, Guid.NewGuid()); PostView.Handle(_postCreatedEvent); }