Exemple #1
0
        public async Task WhenHistoricFoldersAndFilesNotFound_ThenReturnFalseResponse()
        {
            FakeAzureFileHelper fakeAzureFileHelper = new FakeAzureFileHelper();

            A.CallTo(() => fakeScsStorageService.GetStorageAccountConnectionString(A <string> .Ignored, A <string> .Ignored)).Returns(fakeStorageAccountConnectionString);
            A.CallTo(() => fakeAzureFileSystemHelper.DeleteDirectoryAsync(fakeCleanUpConfig.Value.NumberOfDays, fakeStorageAccountConnectionString, fakeStorageConfig.Value.StorageContainerName, fakeFilePath)).Returns(false);

            var response = await exchangeSetCleanUpService.DeleteHistoricFoldersAndFiles();

            Assert.AreEqual(false, response);
            Assert.AreEqual(false, fakeAzureFileHelper.DeleteDirectoryAsyncIsCalled);
        }
Exemple #2
0
        public void WhenScsStorageAccountAccessKeyValueNotFound_ThenReturnKeyNotFoundException()
        {
            FakeAzureFileHelper fakeAzureFileHelper = new FakeAzureFileHelper();

            A.CallTo(() => fakeScsStorageService.GetStorageAccountConnectionString(A <string> .Ignored, A <string> .Ignored))
            .Throws(new KeyNotFoundException("Storage account accesskey not found"));

            Assert.ThrowsAsync(Is.TypeOf <KeyNotFoundException>()
                               .And.Message.EqualTo("Storage account accesskey not found")
                               , async delegate { await exchangeSetCleanUpService.DeleteHistoricFoldersAndFiles(); });

            Assert.AreEqual(false, fakeAzureFileHelper.DeleteDirectoryAsyncIsCalled);
        }