public void IsValidDownloadDirectory_WhenDirectoryDoesNotExist_ReturnsFalse()
        {
            directoryServiceMock.Exists("DownloadDirectory").Returns(false);

            bool actual = systemUnderTest.IsValidDownloadDirectory("DownloadDirectory");

            Assert.That(actual, Is.False);
        }
Ejemplo n.º 2
0
        SetFilePayloadDownloadDetails_WhenDownloadDirectoryDoesNotExist_ThrowsFileDownloadArgumentException()
        {
            downloadSettingsValidatorServiceMock.IsValidDownloadDirectory("DownloadDirectory").Returns(false);

            var filePayload = new FilePayload();

            var actual =
                Assert.Throws <FileDownloadArgumentException>(() => InvokeSetFilePayloadDownloadDetails(filePayload));

            Assert.That(actual.Message, Is.EqualTo("Download directory is invalid"));
        }
        private string GetDownloadDirectory()
        {
            string downloadDirectory = downloadSettingsService.GetDownloadDirectory();

            if (!downloadSettingsValidatorService.IsValidDownloadDirectory(downloadDirectory))
            {
                throw NewFileDownloadArgumentException("Download directory is invalid");
            }

            return(downloadDirectory);
        }