Task <StreamSubscription> Create(object callback) { var mock = new StreamSubscriptionMock(callback); subscriptions.Add(mock); return(Task.FromResult <StreamSubscription>(mock)); }
public override Task <StreamSubscription <TItem> > Subscribe <TOptions>(Func <StreamMessage, Task> callback, TOptions options) { var expectation = Match(options); var expected = expectation != null; var mock = new StreamSubscriptionMock <TItem>(this, callback, options); subscribes.Add(mock); if (expected) { expectation.Apply(); } return(Task.FromResult <StreamSubscription <TItem> >(mock)); }
internal Task <StreamSubscription <TItem> > Resume <TOptions>(Func <StreamMessage, Task> callback, TOptions options) where TOptions : ResumeOptions { var expectation = Match(options); var expected = expectation != null; var mock = new StreamSubscriptionMock <TItem>(this, callback, null, options); resumes.Add(mock); if (expected) { expectation.Apply(); } return(Task.FromResult <StreamSubscription <TItem> >(mock)); }