public void When_transforming_xml_to_html_output_is_generated()
        {
            XElement     element = new XElement("ApiCheckResult");
            MemoryStream sut     = new MemoryStream();

            Assert.DoesNotThrow(() => XmlTransformer.TransformToHtml(element.CreateReader(), sut));
            Assert.Greater(sut.Length, 0);
        }
Exemple #2
0
        /// <summary> Compares the assemblies 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) + _comparerResult.GetAllCount(Severity.Warning));
        }