public async Task Should_enrich_events(ContentEvent @event, EnrichedContentEventType type) { var envelope = Envelope.Create <AppEvent>(@event).SetEventStreamNumber(12); A.CallTo(() => contentLoader.GetAsync(@event.ContentId, 12)) .Returns(new ContentEntity { SchemaId = SchemaMatch }); var result = await sut.CreateEnrichedEventAsync(envelope) as EnrichedContentEvent; Assert.Equal(type, result !.Type); }
public async Task Should_enrich_events(ContentEvent @event, EnrichedContentEventType type) { var envelope = Envelope.Create <AppEvent>(@event).SetEventStreamNumber(12); var contentGrain = A.Fake <IContentGrain>(); A.CallTo(() => grainFactory.GetGrain <IContentGrain>(@event.ContentId, null)) .Returns(contentGrain); A.CallTo(() => contentGrain.GetStateAsync(12)) .Returns(A.Fake <IContentEntity>().AsJ()); var result = await sut.CreateEnrichedEventAsync(envelope); Assert.Equal(type, ((EnrichedContentEvent)result).Type); }
public async Task Should_create_enriched_events(ContentEvent @event, EnrichedContentEventType type) { @event.AppId = appId; var envelope = Envelope.Create <AppEvent>(@event).SetEventStreamNumber(12); A.CallTo(() => contentLoader.GetAsync(appId.Id, @event.ContentId, 12)) .Returns(new ContentEntity { AppId = appId, SchemaId = schemaMatch }); var result = await sut.CreateEnrichedEventsAsync(envelope); var enrichedEvent = result.Single() as EnrichedContentEvent; Assert.Equal(type, enrichedEvent !.Type); }