Пример #1
0
            public void Transaction_Id_Cannot_Be_Emtpy()
            {
                //Arrange
                var connection = new BlobConnection(Mock.Of <IStorageConnectionManager <CloudBlobClient> >());

                //Act
                async Task TestDelegate() => await connection.RemoveObjectAsync(Guid.Empty);

                //Assert
                Assert.That(TestDelegate,
                            Throws.ArgumentException.With.Message.EqualTo("Id cannot be Empty"));
            }
Пример #2
0
            public void Can_Remove_Container()
            {
                //Arrange
                _mockManager.Setup(x => x.GetStorageClient()).Returns(Task.FromResult(_mockClient.Object));
                _mockClient.Setup(x => x.GetContainerReference(It.IsAny <string>())).Returns(_mockContainer.Object);
                _mockContainer.Setup(x => x.DeleteIfExistsAsync()).Returns(Task.FromResult(true));
                var connection = new BlobConnection(_mockManager.Object);

                //Act
                async Task TestDelegate() => await connection.RemoveObjectAsync(Guid.NewGuid());

                //Assert
                Assert.That(TestDelegate, Throws.Nothing);
            }
Пример #3
0
            public void Exception_Thrown_In_Connection_Manager_Will_Bubble_Up()
            {
                //Arrange
                const string exceptionMessage = "Test Exception";

                _mockManager.Setup(x => x.GetStorageClient())
                .Throws(new Exception(exceptionMessage));
                var connection = new BlobConnection(_mockManager.Object);

                //Act
                async Task TestDelegate() => await connection.RemoveObjectAsync(Guid.NewGuid());

                //Assert
                Assert.That(TestDelegate, Throws.Exception.With.Message.EqualTo(exceptionMessage));
            }
Пример #4
0
            public void Exception_Thrown_In_Cloud_Blob_Container_Will_Bubble_Up()
            {
                //Arrange
                const string exceptionMessage = "Test Exception";

                _mockManager.Setup(x => x.GetStorageClient()).Returns(Task.FromResult(_mockClient.Object));
                _mockClient.Setup(x => x.GetContainerReference(It.IsAny <string>())).Returns(_mockContainer.Object);
                _mockContainer.Setup(x => x.DeleteIfExistsAsync()).Throws(new Exception(exceptionMessage));
                var connection = new BlobConnection(_mockManager.Object);

                //Act
                async Task TestDelegate() => await connection.RemoveObjectAsync(Guid.NewGuid());

                //Assert
                Assert.That(TestDelegate, Throws.Exception.With.Message.EqualTo(exceptionMessage));
            }