public async Task IsInitializedAsync_ShouldReturnFalse_IfNoDocument() { var client = Mock.Of <IChangeFeedDocumentClient>(); Mock.Get(client) .Setup(c => c.ReadDocumentAsync(It.Is <Uri>(uri => uri.ToString().EndsWith(storeMarker)))) .ThrowsAsync(DocumentExceptionHelpers.CreateNotFoundException()); var leaseStore = new LeaseStore(client, collectionInfo, containerNamePrefix, leaseStoreCollectionLink); bool isInited = await leaseStore.IsInitializedAsync(); Assert.False(isInited); }
public async Task IsInitializedAsync_ShouldReturnTrue_IfDocumentExist() { var client = Mock.Of <IChangeFeedDocumentClient>(); Mock.Get(client) .Setup(c => c.ReadDocumentAsync(It.Is <Uri>(uri => uri.ToString().EndsWith(storeMarker)))) .ReturnsAsync(CreateResponse()); var leaseStore = new LeaseStore(client, collectionInfo, containerNamePrefix, leaseStoreCollectionLink); bool isInited = await leaseStore.IsInitializedAsync(); Assert.True(isInited); }