コード例 #1
0
        public void IsValidDirectoryPath_NullInput_ThrowsNullArgumentException()
        {
            // Arrange
            string directoryPath = null;

            // Act
            TestDelegate action = () => MultiPurposeValidator.IsValidDirectoryPath(directoryPath);

            // Assert
            Assert.Throws <ArgumentNullException>(action);
        }
コード例 #2
0
        public ScreenshotCommand(string fileName, string directoryPath)
        {
            _fileName      = fileName ?? throw new ArgumentNullException(nameof(fileName));
            _directoryPath = directoryPath ?? throw new ArgumentNullException(nameof(directoryPath));

            if (!MultiPurposeValidator.IsValidFileName(fileName))
            {
                throw new ArgumentException($"Invalid file name: {fileName}");
            }
            if (!MultiPurposeValidator.IsValidDirectoryPath(directoryPath))
            {
                throw new ArgumentException($"Invalid directory: {directoryPath}");
            }
        }