public void GivenOneEvent_WhenStreamIsStarting_ThenEventsAreSavedWithoutError() { var @event = new IssueCreated { IssueId = Guid.NewGuid(), Description = "Description" }; var streamId = EventStore.StartStream <IssuesList>(@event.IssueId, @event); streamId.Should().Not.Be.Null(); Session.SaveChanges(); }
public async Task issue_created_event_fails_when_project_with_id_does_not_exist() { var issueId = "issueKey" + Guid.NewGuid(); var projectId = "projectKey" + Guid.NewGuid(); var externalEvent = new IssueCreated(issueId, projectId); // Check if exception is thrown _eventHandler .Awaiting(c => c.HandleAsync(externalEvent)) .Should().Throw <ProjectNotFoundException>(); }
public void using_visualizer() { // SAMPLE: using-visualizer-knowning-the-type // Just setting up a Container and ILogVisualizer var container = Container.For <VisualizationRegistry>(); var visualizer = container.GetInstance <ILogVisualizer>(); // If I have an IssueCreated lob object... var created = new IssueCreated(); // I can get the html representation: var html = visualizer.ToHtml(created); // ENDSAMPLE }
public void GivenOneEvent_WhenEventsArePublishedWithStreamId_ThenEventsAreSavedWithoutErrorAndStreamIsStarted() { var @event = new IssueCreated(Guid.NewGuid(), "Description"); var streamId = Guid.NewGuid(); EventStore.Append(streamId, @event); Session.SaveChanges(); var streamState = EventStore.FetchStreamState(streamId); streamState.Should().Not.Be.Null(); streamState.Version.Should().Be.EqualTo(1); }
public void GivenStartedStream_WhenStartStreamIsBeingCalledAgain_ThenExceptionIsThrown() { var @event = new IssueCreated(Guid.NewGuid(), "Description"); var streamId = EventStore.StartStream(@event.IssueId, @event); Session.SaveChanges(); Assert.Throws <ExistingStreamIdCollisionException>(() => { EventStore.StartStream(@event.IssueId, @event); Session.SaveChanges(); }); }
public void using_visualizer() { // SAMPLE: using-visualizer-knowning-the-type // Just setting up a Container and ILogVisualizer var container = Container.For<VisualizationRegistry>(); var visualizer = container.GetInstance<ILogVisualizer>(); // If I have an IssueCreated lob object... var created = new IssueCreated(); // I can get the html representation: var html = visualizer.ToHtml(created); // ENDSAMPLE }
public async void GivenNonRegisteredQueryHandler_WhenPublishMethodIsBeingCalled_ThenThrowsAnError() { var ex = await Record.ExceptionAsync(async() => { //Given var serviceLocator = new ServiceLocator(); var mediator = new Mediator(type => serviceLocator.Get(type).FirstOrDefault()); var @event = new IssueCreated("cleaning"); //When await mediator.Publish(@event); }); //Then ex.Should().Not.Be.Null(); }
public async Task issue_created_event_fails_when_issue_with_id_already_exists() { var issueId = "issueKey" + Guid.NewGuid(); var projectId = "projectKey" + Guid.NewGuid(); var project = new Project(projectId); await _projectMongoDbFixture.InsertAsync(project.AsDocument()); var issue = new Issue(issueId, projectId, null); await _issueMongoDbFixture.InsertAsync(issue.AsDocument()); var externalEvent = new IssueCreated(issueId, projectId); // Check if exception is thrown _eventHandler .Awaiting(c => c.HandleAsync(externalEvent)) .Should().Throw <IssueAlreadyCreatedException>(); }
public async Task issue_created_event_should_add_issue_with_given_data_to_database() { var issueId = "issueKey" + Guid.NewGuid(); var projectId = "projectKey" + Guid.NewGuid(); var project = new Project(projectId); await _projectMongoDbFixture.InsertAsync(project.AsDocument()); var externalEvent = new IssueCreated(issueId, projectId); // Check if exception is thrown _eventHandler .Awaiting(c => c.HandleAsync(externalEvent)) .Should().NotThrow(); var issue = await _issueMongoDbFixture.GetAsync(issueId); issue.Should().NotBeNull(); issue.Id.Should().Be(issueId); issue.ProjectId.Should().Be(projectId); issue.SprintId.Should().BeNull(); }
public void Apply(IssueCreated @event, IssueDescriptions item) { item.Apply(@event); }
public void Apply(IssueCreated @event) { Id = @event.IssueId; Description = $"New Logic: {@event.Description}"; }
public void Apply(IssueCreated @event) { Id = @event.IssueId; Description = @event.Description; }
private void Apply(Contracts.Issues.Views.Issue item, IssueCreated @event) { }
private void Apply(IssueView item, IssueCreated @event) { }
public void ApplyEvent(IssueCreated @event) { Descriptions.Add(@event.IssueId, @event.Description); }
public void Apply(IssueCreated @event) { List.Add(new Issue { IssueId = @event.IssueId, Description = @event.Description }); }
public void Apply(IssueCreated @event) { var(issueId, description) = @event; Issues.Add(issueId, new Issue(issueId, description)); }