Ejemplo n.º 1
0
        public void DannIstDasErgebnisDasGleicheWieInDerReferenzAuswertung(string reportName)
        {
            var outPutDir = TestDeploymentHelper.GetTestOutputDir();

            var referenceTiffFilePath = Directory.GetFiles(Path.Combine(outPutDir, "RefrenzAuswertungen"), string.Format("{0}.tiff", reportName), SearchOption.AllDirectories).FirstOrDefault();

            var actuallNamedPdfFilePath = GetActuallNamedFilePath(OutputFormat.Pdf, reportName);

            GetActuallNamedFilePath(OutputFormat.Excel, reportName);
            GetActuallNamedFilePath(OutputFormat.Xml, reportName);

            string actualNamedTiffFilePath = GetActuallNamedFilePath(OutputFormat.Image, reportName);

            Assert.IsNotNull(referenceTiffFilePath, string.Format("RefrenzAuswertungen {0} not found!", reportName));

            var differentReportResultsDirectory = Path.Combine(outPutDir, "DifferentReportResults");

            if (!Directory.Exists(differentReportResultsDirectory))
            {
                Directory.CreateDirectory(differentReportResultsDirectory);
            }

            var areEqual = ImageHelpers.AreEqualByPixel(referenceTiffFilePath, actualNamedTiffFilePath);

            if (!areEqual)
            {
                File.Copy(actualNamedTiffFilePath, Path.Combine(differentReportResultsDirectory, Path.GetFileName(actualNamedTiffFilePath)), true);
                File.Copy(actuallNamedPdfFilePath, Path.Combine(differentReportResultsDirectory, Path.GetFileName(actuallNamedPdfFilePath)), true);
            }

            Assert.IsTrue(areEqual, "Reports are different. Referenceze path: {0} - actual path: {1}", referenceTiffFilePath, actualNamedTiffFilePath);
        }