public async Task FreeAsync_ReleasesAcquiredBlobLease( [Frozen] Mock<ICloudBlockBlob> blobMock, string consumerId, string leaseId, EventStreamConsumingSession session) { blobMock .Setup(self => self.AcquireLeaseAsync(null)) .Returns(leaseId.YieldTask()); await session.PromoteToLeaderAsync(); await session.FreeAsync(); blobMock.Verify(self => self.ReleaseLeaseAsync(leaseId)); }
public async Task PromoteToLeader_WhenBlobLeaseWasFreed_TakesLeaseOnce( [Frozen] Mock<ICloudBlockBlob> blobMock, string consumerId, EventStreamConsumingSession session) { await session.PromoteToLeaderAsync(); await session.FreeAsync(); await session.PromoteToLeaderAsync(); blobMock.Verify(self => self.AcquireLeaseAsync(null), Times.Exactly(2)); }