Esempio n. 1
0
        public async Task FetchAttributesIfExistsAsyncReturnsTrueOnSuccess()
        {
            var target = new CloudBlobWrapper(_cloudBlobMock.Object);

            _cloudBlobMock
            .Setup(cb => cb.FetchAttributesAsync())
            .Returns(Task.CompletedTask)
            .Verifiable();

            var result = await target.FetchAttributesIfExistsAsync();

            _cloudBlobMock.VerifyAll();
            Assert.True(result);
        }
Esempio n. 2
0
        public async Task FetchAttributesIfExistsAsyncReturnsFalseOnNoBlob()
        {
            var target = new CloudBlobWrapper(_cloudBlobMock.Object);

            _cloudBlobMock
            .Setup(cb => cb.FetchAttributesAsync())
            .ThrowsAsync(CreateBlobNotFoundException())
            .Verifiable();

            var result = await target.FetchAttributesIfExistsAsync();

            _cloudBlobMock.VerifyAll();
            Assert.False(result);
        }
Esempio n. 3
0
        public async Task FetchAttributesIfExistsAsyncPassesThroughExceptions()
        {
            var target    = new CloudBlobWrapper(_cloudBlobMock.Object);
            var exception = new TestException();

            _cloudBlobMock
            .Setup(cb => cb.FetchAttributesAsync())
            .ThrowsAsync(exception)
            .Verifiable();

            var thrownException = await Assert.ThrowsAsync <TestException>(() => target.FetchAttributesIfExistsAsync());

            _cloudBlobMock.VerifyAll();
            Assert.Same(exception, thrownException);
        }