internal void OnStarted(TestLifetime lifetime, TestTimeline timeline) { Lifetime = lifetime; Timeline = timeline; _startBlock.Set(); }
internal TestLifetime(TestApp app, TestTimeline timeline, IApplicationLifetime appLifetime) { _app = app; _timeline = timeline; _appLifetime = appLifetime; appLifetime.ApplicationStarted.Register(OnAppStarted); appLifetime.ApplicationStopped.Register(OnAppStopped); }
internal async Task <TQuery> GetAfter <TQuery>(Id id, Event e, TestTimeline timeline) where TQuery : Query { var key = GetKey <TQuery>(id); ExpectObserves(key.Type, e); var content = await AppendAndWaitUntilChanged(key, e, timeline); return((TQuery)Deserialize(key.Type, content)); }
async Task <Stream> AppendAndWaitUntilChanged(FlowKey key, Event e, TestTimeline timeline) { var connectionId = Id.FromGuid(); await _queryDb.SubscribeToChanged(connectionId, QueryETag.From(key)); var position = await timeline.Append(e); var newETag = QueryETag.From(key, position); await _notifier.WaitUntilChanged(connectionId, newETag); _queryDb.UnsubscribeFromChanged(connectionId); return(await _queryDb.ReadContent(newETag)); }