public async Task Should_be_when_projected_multiple() { //Arrange var connector = new InMemoryConnector(); var projector = new ConnectedProjector <InMemoryConnector>(connector, _ => new List <IProjection <InMemoryConnector> > { new CarProjection(), new CarHistoryProjection() }); var @event = new CarRegisteredEvent("123", "Ferrari"); //Act await projector.ProjectAsync(@event).ConfigureAwait(false); //Assertion var carView = connector.Get <CarView>("123"); carView.Should().NotBeNull(); carView.Name.Should().Be("Ferrari"); var carHistoryView = connector.Get <CarHistoryView>("123"); carHistoryView.Should().NotBeNull(); carHistoryView.Name.Should().Be("Ferrari"); }
public void Should_throw_not_registered_when_projected() { //Arrange var connector = new InMemoryConnector(); var projector = new ConnectedProjector <InMemoryConnector>(connector, _ => null); var @event = new CarRegisteredEvent("123", "Ferrari"); //Act Func <Task> act = () => projector.ProjectAsync(@event); act.Should().Throw <ProjectionNotRegisteredException>(); }