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 void Context() { attempt = BuildCommitStub(1, 1); PipelineHooks.Add(new Mock <IPipelineHook>()); PipelineHooks[0].Setup(x => x.PreCommit(attempt)).Returns(false); }
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 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 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() { _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)); }
public void should_provide_the_commits_to_the_selection_hooks() { PipelineHooks.ForEach(x => A.CallTo(() => x.Select(_committed)).MustHaveHappened(Repeated.Exactly.Once)); }
public void should_provide_the_commit_to_the_precommit_hooks() { PipelineHooks.ForEach(x => x.Received(1).PreCommit(_populatedAttempt)); }
public void should_provide_the_commit_to_the_precommit_hooks() { PipelineHooks.ForEach(x => A.CallTo(() => x.PreCommit(_populatedAttempt)).MustHaveHappenedOnceExactly()); }
public void should_provide_the_commits_to_the_selection_hooks() { PipelineHooks.ForEach(x => x.Verify(hook => hook.Select(_committed), Times.Once())); }
public void should_not_provide_the_commit_to_the_postcommit_hooks() { PipelineHooks.ForEach(x => A.CallTo(() => x.PostCommitAsync(_commit, A <CancellationToken> ._)).MustNotHaveHappened()); }
public void should_provide_the_commit_to_the_precommit_hooks() { PipelineHooks.ForEach(x => x.Verify(hook => hook.PreCommit(populatedAttempt), Times.Once())); }
public void should_provide_the_commit_to_the_precommit_hooks() { PipelineHooks.ForEach(x => A.CallTo(() => x.PreCommitAsync(_populatedAttempt, A <CancellationToken> ._)).MustHaveHappened(Repeated.Exactly.Once)); }
public void should_provide_the_commit_to_the_postcommit_hooks() { PipelineHooks.ForEach(x => x.Verify(hook => hook.PostCommit(_populatedCommit), Times.Once())); }
protected override void Because() { PipelineHooks.Add(A.Fake <IPipelineHook>()); }
public void should_provide_the_commit_to_the_postcommit_hooks() { PipelineHooks.ForEach(x => A.CallTo(() => x.PostCommit(_populatedCommit)).MustHaveHappened(Repeated.Exactly.Once)); }
public void should_provide_the_commits_to_the_selection_hooks() { PipelineHooks.ForEach(x => x.Received(1).Select(_committed) ); }
public void should_not_provide_the_commit_to_the_postcommit_hooks() { PipelineHooks.ForEach(x => A.CallTo(() => x.PostCommit(_commit)).MustNotHaveHappened()); }
public void should_not_provide_the_commit_to_the_postcommit_hooks() { PipelineHooks.ForEach(x => x.Verify(y => y.PostCommit(_commit), Times.Never())); }