public async Task GivenThatExistaAListOfEventsThenShouldBeRaisedAllEventsFromLista() { var expectedAggregatedId = Guid.NewGuid().ToString(); var fakeEvents = new Queue <INotifiableCelebrityEvent>(); fakeEvents.Enqueue(new FakeNotifiableCelebrityEvent(expectedAggregatedId, new { Foo = "Foo", Bar = "Bar" })); _eventStore.Get(Arg.Any <string>()).ReturnsForAnyArgs(fakeEvents); var events = await _eventStore.Get(expectedAggregatedId); events.Should().HaveCount(fakeEvents.Count); }
public async Task ShouldReturnEventsRelatedByAggregatedId() { var expectedAggreagatedId = Guid.NewGuid().ToString(); var fisrtEvent = new FakeCelebrityEvent(expectedAggreagatedId, new { Foo = "Foo", Bar = "Bar" }); await _eventStore.Commit(fisrtEvent); var secondEvent = new FakeCelebrityEvent(expectedAggreagatedId, new { Foo = "Foo", Bar = "Bar" }); await _eventStore.Commit(secondEvent); var result = await _eventStore.Get(fisrtEvent.AggregatedId); result.Should().BeAssignableTo <IReadOnlyCollection <ICelebrityEvent> >(); }
public async Task <IReadOnlyCollection <ICelebrityEvent> > Get(string aggregatedId) => await _eventStore.Get(aggregatedId);