protected override void Context() { attempt = BuildCommitStub(1, 1); PipelineHooks.Add(new Mock <IPipelineHook>()); PipelineHooks[0].Setup(x => x.PreCommit(attempt)).Returns(false); }
protected override void Context() { _populatedAttempt = BuildCommitAttemptStub(1, 1); A.CallTo(() => Persistence.Commit(_populatedAttempt)) .ReturnsLazily((CommitAttempt attempt) => { _populatedCommit = new Commit(attempt.BucketId, attempt.StreamId, attempt.StreamRevision, attempt.CommitId, attempt.CommitSequence, attempt.CommitStamp, new LongCheckpoint(0).Value, attempt.Headers, attempt.Events); return(_populatedCommit); }); var hook = A.Fake <IPipelineHook>(); A.CallTo(() => hook.PreCommit(_populatedAttempt)).Returns(true); PipelineHooks.Add(hook); }
protected override Task Context() { _populatedAttempt = BuildCommitAttemptStub(1, 1); A.CallTo(() => Persistence.CommitAsync(_populatedAttempt, A <CancellationToken> ._)) .ReturnsLazily((CommitAttempt attempt) => { _populatedCommit = new Commit(attempt.BucketId, attempt.StreamId, attempt.StreamRevision, attempt.CommitId, attempt.CommitSequence, attempt.CommitStamp, 0, attempt.Headers, attempt.Events); return(_populatedCommit); }); var hook = A.Fake <IPipelineHook>(); A.CallTo(() => hook.PreCommitAsync(_populatedAttempt, A <CancellationToken> ._)).Returns(true); PipelineHooks.Add(hook); return(Task.CompletedTask); }
protected override void Context() { _committed = BuildCommitStub(MinRevision, 1); Persistence.Setup(x => x.GetFrom(Bucket.Default, streamId, MinRevision, MaxRevision)).Returns(new[] { _committed }); PipelineHooks.Add(new Mock <IPipelineHook>()); PipelineHooks[0].Setup(x => x.Select(_committed)).Returns(_committed); }
protected override void Context() { populatedAttempt = BuildCommitStub(1, 1); Persistence.Setup(x => x.Commit(populatedAttempt)); PipelineHooks.Add(new Mock <IPipelineHook>()); PipelineHooks[0].Setup(x => x.PreCommit(populatedAttempt)).Returns(true); PipelineHooks[0].Setup(x => x.PostCommit(populatedAttempt)); }
protected override void Context() { _attempt = BuildCommitAttemptStub(1, 1); _commit = BuildCommitStub(1, 1); var hook = A.Fake <IPipelineHook>(); A.CallTo(() => hook.PreCommit(_attempt)).Returns(false); PipelineHooks.Add(hook); }
protected override void Context() { _committed = BuildCommitStub(MinRevision, 1); A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, MinRevision, MaxRevision)) .Returns(new[] { _committed }); var hook = A.Fake <IPipelineHook>(); A.CallTo(() => hook.Select(_committed)).Returns(_committed); PipelineHooks.Add(hook); }
protected override Task Context() { _attempt = BuildCommitAttemptStub(1, 1); _commit = BuildCommitStub(1, 1); var hook = A.Fake <IPipelineHook>(); A.CallTo(() => hook.PreCommitAsync(_attempt, A <CancellationToken> ._)).Returns(false); PipelineHooks.Add(hook); return(Task.CompletedTask); }
protected override Task Context() { _committed = BuildCommitStub(MinRevision, 1); A.CallTo(() => Persistence.GetFromAsync(Bucket.Default, streamId, MinRevision, MaxRevision, CancellationToken.None)) .Returns(new[] { _committed }); var hook = A.Fake <IPipelineHook>(); A.CallTo(() => hook.SelectAsync(_committed, A <CancellationToken> ._)).Returns(_committed); PipelineHooks.Add(hook); return(Task.CompletedTask); }
protected override Task Context() { _attempt = BuildCommitAttemptStub(1, 1); _commit = BuildCommitStub(1, 1); //var hook = A.Fake<IPipelineHook>(); //A.CallTo(() => hook.PreCommit(_attempt)).Returns(false); var hook = Substitute.For <IPipelineHook>(); hook.PreCommit(_attempt).Returns(false); PipelineHooks.Add(hook); return(Task.FromResult(true)); }
protected override Task Context() { _committed = BuildCommitStub(MinRevision, 1); Persistence.GetFrom(Bucket.Default, streamId, MinRevision, MaxRevision) .Returns(new[] { _committed }.ToAsync()); //A.CallTo(() => Persistence.GetFrom(Bucket.Default, streamId, MinRevision, MaxRevision)) // .Returns(new[] { _committed }.ToAsync()); var hook = Substitute.For <IPipelineHook>(); //A.CallTo(() => hook.Select(_committed)).Returns(_committed); hook.Select(_committed).Returns(_committed); PipelineHooks.Add(hook); return(Task.FromResult(true)); }
protected override Task Context() { _populatedAttempt = BuildCommitAttemptStub(1, 1); Persistence.Commit(_populatedAttempt) .Returns(callInfo => { var attempt = callInfo.Arg <CommitAttempt>(); _populatedCommit = new Commit(attempt.BucketId, attempt.StreamId, attempt.StreamRevision, attempt.CommitId, attempt.CommitSequence, attempt.CommitStamp, new LongCheckpoint(0).Value, attempt.Headers, attempt.Events); return(_populatedCommit); }); //A.CallTo(() => Persistence.Commit(_populatedAttempt)) // .ReturnsLazily((CommitAttempt attempt) => // { // _populatedCommit = new Commit(attempt.BucketId, // attempt.StreamId, // attempt.StreamRevision, // attempt.CommitId, // attempt.CommitSequence, // attempt.CommitStamp, // new LongCheckpoint(0).Value, // attempt.Headers, // attempt.Events); // return _populatedCommit; // }); //var hook = A.Fake<IPipelineHook>(); //A.CallTo(() => hook.PreCommit(_populatedAttempt)).Returns(true); var hook = Substitute.For <IPipelineHook>(); hook.PreCommit(_populatedAttempt).Returns(true); PipelineHooks.Add(hook); return(Task.FromResult(true)); }
protected override void Context() { _populatedAttempt = BuildCommitAttemptStub(1, 1); Persistence.Setup(x => x.Commit(_populatedAttempt)) .Returns((CommitAttempt attempt) => { _populatedCommit = new Commit(attempt.BucketId, attempt.StreamId, attempt.StreamRevision, attempt.CommitId, attempt.CommitSequence, attempt.CommitStamp, new IntCheckpoint(0).Value, attempt.Headers, attempt.Events); return(_populatedCommit); }); PipelineHooks.Add(new Mock <IPipelineHook>()); PipelineHooks[0].Setup(x => x.PreCommit(_populatedAttempt)).Returns(true); PipelineHooks[0].Setup(x => x.PostCommit(_populatedCommit)); }
protected override void Because() { PipelineHooks.Add(A.Fake <IPipelineHook>()); }