public PartitionControllerTests() { this.lease = Mock.Of <DocumentServiceLease>(); Mock.Get(this.lease) .Setup(l => l.CurrentLeaseToken) .Returns("partitionId"); this.partitionProcessor = MockPartitionProcessor(); this.leaseRenewer = MockRenewer(); this.observer = Mock.Of <ChangeFeedObserver>(); this.partitionSupervisorFactory = Mock.Of <PartitionSupervisorFactory>(f => f.Create(this.lease) == new PartitionSupervisorCore(this.lease, this.observer, this.partitionProcessor, this.leaseRenewer)); this.leaseManager = Mock.Of <DocumentServiceLeaseManager>(); Mock.Get(this.leaseManager).Reset(); // Reset implicit/by default setup of properties. Mock.Get(this.leaseManager) .Setup(manager => manager.AcquireAsync(this.lease)) .ReturnsAsync(this.lease); Mock.Get(this.leaseManager) .Setup(manager => manager.ReleaseAsync(this.lease)) .Returns(Task.CompletedTask); DocumentServiceLeaseContainer leaseContainer = Mock.Of <DocumentServiceLeaseContainer>(); this.synchronizer = Mock.Of <PartitionSynchronizer>(); this.sut = new PartitionControllerCore(leaseContainer, this.leaseManager, this.partitionSupervisorFactory, this.synchronizer); }
public PartitionSupervisorTests() { this.lease = Mock.Of <DocumentServiceLease>(); Mock.Get(this.lease) .Setup(l => l.CurrentLeaseToken) .Returns("partitionId"); this.leaseRenewer = Mock.Of <LeaseRenewer>(); this.partitionProcessor = Mock.Of <FeedProcessor>(); this.observer = Mock.Of <ChangeFeedObserver>(); this.sut = new PartitionSupervisorCore(this.lease, this.observer, this.partitionProcessor, this.leaseRenewer); }
public PartitionSupervisorTests() { lease = Mock.Of <DocumentServiceLease>(); Mock.Get(lease) .Setup(l => l.CurrentLeaseToken) .Returns("partitionId"); leaseRenewer = Mock.Of <LeaseRenewer>(); partitionProcessor = Mock.Of <FeedProcessor>(); observer = Mock.Of <ChangeFeedObserver <dynamic> >(); sut = new PartitionSupervisorCore <dynamic>(lease, observer, partitionProcessor, leaseRenewer); }