Exemplo n.º 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);
 }
Exemplo n.º 2
0
Arquivo: Post.cs Projeto: 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);
 }
Exemplo n.º 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);
     }
 }
Exemplo n.º 4
0
Arquivo: Post.cs Projeto: 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;
 }
Exemplo n.º 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);
 }