예제 #1
0
 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);
 }
예제 #2
0
파일: Post.cs 프로젝트: mastoj/NBlog
 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);
 }
예제 #3
0
 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);
     }
 }
예제 #4
0
파일: Post.cs 프로젝트: mastoj/NBlog
 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;
 }
예제 #5
0
 public override void When()
 {
     _postCreatedEvent = new PostCreatedEvent("Title", "Content", "slug", new List<string>() {"tag1", "tag2"}, "Excerpt", DateTime.Now, Guid.NewGuid());
     PostView.Handle(_postCreatedEvent);
 }