private void Handle(PostCreated evnt) { using (var conn = _connectionFactory.OpenConnection()) { conn.Insert(evnt, "EventSourcing_Sample_Post"); } }
public void When(PostCreated postCreated) { PostId = postCreated.PostId; AuthorId = postCreated.AuthorId; Title = postCreated.Title; Slug = postCreated.Slug; }
public void Setup() { _command = PostFactories.CreatePostCommand(); _validatorMock = new Mock <IValidator <CreatePost> >(); _validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult()); _post = new Post(_command, _validatorMock.Object); _event = _post.Events.OfType <PostCreated>().Single(); }
public async Task <IReadOnlyCollection <IAction> > Handle(PostCreated @event) { return(new List <IAction> { new AddToCategory { Id = @event.Id, Category = "My Category" } }); }
void IEventHandler <PostCreated> .Handle(PostCreated evnt) { ParentId = evnt.ParentId; RootId = evnt.RootId; Subject = evnt.Subject; Body = evnt.Body; SectionId = evnt.SectionId; AuthorId = evnt.AuthorId; CreatedOn = evnt.CreatedOn; UpdatedOn = evnt.CreatedOn; }
public void Process(PostCreated created) { var post = new Post { Id = created.EventSourceId, Title = created.Title, Body = created.Body }; InsertEntity(post); }
private void Apply(PostCreated @event) { Id = @event.AggregateRootId; BlogId = @event.BlogId; Title = @event.Title; Slug = @event.Slug; Excerpt = @event.Excerpt; Content = @event.Content; Tags = @event.Tags; Type = @event.Type; Status = @event.Status; StatusTimeStamp = @event.TimeStamp; }
public async Task Setup() { _command = PostFactories.CreatePostCommand(); _validatorMock = new Mock <IValidator <CreatePost> >(); _validatorMock.Setup(x => x.Validate(_command)).Returns(new ValidationResult()); _postRepositoryMock = new Mock <IPostRepository>(); _postRepositoryMock .Setup(x => x.CreateAsync(It.IsAny <Post>())) .Callback <Post>(p => _post = p) .Returns(Task.CompletedTask); _commandHandler = new CreatePostHandler(_postRepositoryMock.Object, _validatorMock.Object); _result = await _commandHandler.HandleAsync(_command); _event = _post.Events.OfType <PostCreated>().Single(); }
protected virtual void Handle(PostCreated evnt) { _entityManager.BuildAndSave<PostEntity>(evnt); }
private void OnPostCreated(Post post) { // Check if there is any subscriber, then invoke PostCreated?.Invoke(this, new PostEventArgs(post)); }
public void Apply(PostCreated evt) { Id = evt.PostId; }
protected virtual void Handle(PostCreated evnt) { _entityManager.BuildAndSave <PostEntity>(evnt); }
public void CreatePost(Post post) { _posts.Add(post); PostCreated?.Invoke(post); }
public When_initializing() { _sut = new PostCreated(_post); }
public void Handle(PostCreated evnt) { PostTest.PostId = evnt.PostId; TestBase.EventHandlerWaiter.Set(); }