private static OutputFile WriteOutputFiles(OutputFileFormat outputFileFormat, IScanTools scanTools, A11yElement element, Guid elementId)
        {
            if (scanTools == null)
            {
                throw new ArgumentNullException(nameof(scanTools));
            }
            if (scanTools.OutputFileHelper == null)
            {
                throw new ArgumentException(ErrorMessages.ScanToolsOutputFileHelperNull, nameof(scanTools));
            }

            string a11yTestOutputFile = null;

            if (outputFileFormat.HasFlag(OutputFileFormat.A11yTest))
            {
                scanTools.Actions.CaptureScreenshot(elementId);

                a11yTestOutputFile = scanTools.OutputFileHelper.GetNewA11yTestFilePath();
                if (a11yTestOutputFile == null)
                {
                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ErrorMessages.VariableNull, nameof(a11yTestOutputFile)));
                }

                scanTools.Actions.SaveA11yTestFile(a11yTestOutputFile, element, elementId);
            }

            return(OutputFile.BuildFromA11yTestFile(a11yTestOutputFile));
        }
示例#2
0
        private static OutputFile WriteOutputFiles(OutputFileFormat outputFileFormat, IScanTools scanTools, A11yElement element, Guid elementId)
        {
            if (scanTools?.OutputFileHelper == null)
            {
                throw new ArgumentNullException(nameof(scanTools.OutputFileHelper));
            }

            string a11yTestOutputFile = null;

            if (outputFileFormat.HasFlag(OutputFileFormat.A11yTest))
            {
                scanTools.Actions.CaptureScreenshot(elementId);

                a11yTestOutputFile = scanTools.OutputFileHelper.GetNewA11yTestFilePath();
                if (a11yTestOutputFile == null)
                {
                    throw new InvalidOperationException(nameof(a11yTestOutputFile));
                }

                scanTools.Actions.SaveA11yTestFile(a11yTestOutputFile, element, elementId);
            }

#if NOT_CURRENTLY_SUPPORTED
            if (locationHelper.IsSarifExtension())
            // SaveAction.SaveSarifFile(outputFileHelper.GetNewSarifFilePath(), ec2.Id, !locationHelper.IsAllOption());
#endif

            return(OutputFile.BuildFromA11yTestFile(a11yTestOutputFile));
        }