Example #1
0
        /// <summary> Compares the versions of the API and generates the desired reports. </summary>
        /// <returns> The amount of errors and warnings found. </returns>
        public int CheckApi()
        {
            // Comparing
            _comparerContext.LogInfo("Comparing assemblies.");
            ComparerResult = _comparerContext.CreateComparer(_referenceVersion, _newVersion).Compare();

            // Reporting
            _comparerContext.LogInfo("Generating xml result.");
            XElement element = XmlGenerator.GenerateXml(ComparerResult);

            if (_xmlOutput != null)
            {
                _comparerContext.LogInfo("Exporting xml report.");
                element.Save(_xmlOutput);
            }
            if (_htmlOutput != null)
            {
                _comparerContext.LogInfo("Exporting html report.");
                XmlTransformer.TransformToHtml(element.CreateReader(), _htmlOutput);
            }
            return(ComparerResult.GetAllCount(Severity.Error, false) + ComparerResult.GetAllCount(Severity.Warning, false));
        }