コード例 #1
0
        public void AnalyzeCommand_LoadConfigurationFile(string configValue, bool defaultFileExists, string expectedFileName)
        {
            var options = new TestAnalyzeOptions
            {
                TargetFileSpecifiers = new string[] { "" },
                Verbose               = true,
                Statistics            = true,
                Quiet                 = true,
                ComputeFileHashes     = true,
                ConfigurationFilePath = configValue,
                Recurse               = true,
                OutputFilePath        = "",
            };

            var command = new TestAnalyzeCommand();

            string fileName = command.GetConfigurationFileName(options, defaultFileExists);

            if (string.IsNullOrEmpty(expectedFileName))
            {
                fileName.Should().BeNull();
            }
            else
            {
                fileName.Should().EndWith(expectedFileName);
            }
        }
コード例 #2
0
        public void AnalyzeCommandBase_LoadConfigurationFile(string configValue, bool defaultFileExists, string expectedFileName)
        {
            var options = new TestAnalyzeOptions
            {
                TargetFileSpecifiers = new string[] { "" },
                Verbose               = true,
                Quiet                 = true,
                DataToInsert          = new OptionallyEmittedData[] { OptionallyEmittedData.Hashes },
                ConfigurationFilePath = configValue,
                Recurse               = true,
                OutputFilePath        = "",
            };

            var mockFileSystem = new Mock <IFileSystem>();

            mockFileSystem.Setup(x => x.FileExists(It.IsAny <string>())).Returns(defaultFileExists);

            var command = new TestAnalyzeCommand(mockFileSystem.Object);

            string fileName = command.GetConfigurationFileName(options);

            if (string.IsNullOrEmpty(expectedFileName))
            {
                fileName.Should().BeNull();
            }
            else
            {
                fileName.Should().EndWith(expectedFileName);
            }
        }