示例#1
0
        Task <StreamSubscription> Create(object callback)
        {
            var mock = new StreamSubscriptionMock(callback);

            subscriptions.Add(mock);

            return(Task.FromResult <StreamSubscription>(mock));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }