StatLight.Core.Reporting.Providers.Xml.XmlReport.WriteXmlReport C# (CSharp) Method

WriteXmlReport() public method

public WriteXmlReport ( string outputFilePath ) : void
outputFilePath string
return void
        public void WriteXmlReport(string outputFilePath)
        {
            using (var writer = new StreamWriter(outputFilePath))
            {
                var xml = GetXmlReport();
                xml.Save(writer);
                //writer.Write(xml.ToString(options:SaveOptions.None));
                writer.Close();
            }
        }

Usage Example

Exemplo n.º 1
0
        private static void WriteXmlReport(TestReportCollection testReports, string xmlReportOutputPath, XmlReportType xmlReportType)
        {
            if (!string.IsNullOrEmpty(xmlReportOutputPath))
            {
                IXmlReport xmlReport = null;
                switch (xmlReportType)
                {
                    case XmlReportType.TFS:
                        xmlReport = new Core.Reporting.Providers.TFS.TFS2010.XmlReport(testReports);
                        break;
                    case XmlReportType.StatLight:
                        xmlReport = new XmlReport(testReports);
                        break;
                    default:
                        throw new StatLightException("Unknown XmlReportType chosen Name=[{0}], Value=[{1}]".FormatWith(xmlReportType.ToString(), (int)xmlReportType));
                }

                xmlReport.WriteXmlReport(xmlReportOutputPath);

                "*********************************"
                    .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorInformatoin, true);

                "Wrote XML report to:{0}{1}"
                    .FormatWith(Environment.NewLine, new FileInfo(xmlReportOutputPath).FullName)
                    .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorWarning, true);

                "*********************************"
                    .WrapConsoleMessageWithColor(Settings.Default.ConsoleColorInformatoin, true);
            }
        }