예제 #1
0
        private iTool IdentifyTool()
        {
            iTool toolToExecute = new NOP();

            switch (this.operation.ToLower())
            {
            case "export security":
                toolToExecute = new ExportSecurity();
                break;

            case "export alerts":
                toolToExecute = new ExportAlerts();
                break;

            case "comparison report":
                toolToExecute = new ComparisonReport();
                break;

            case "site structure":
                toolToExecute = new SiteStructure();
                break;

            case "list report":
                toolToExecute = new ListReport();
                break;
            }

            return(toolToExecute);
        }
        public static void ChooseBasicComparisons()
        {
            // Load same file twice
            // change the other a little, save it and reload so we get a fresh instance
            // bypassing some bugs that lead to not everything updating on the fly :(

            var path     = Path.Combine("data", "minimal.xbrl");
            var tempPath = Path.GetTempFileName();

            var first  = Instance.FromFile(path);
            var second = Instance.FromFile(path);

            var period = new Period(2050, 12, 31);
            var entity = new Entity("foo", "bar");

            foreach (var context in second.Contexts)
            {
                context.Period = period;
                context.Entity = entity;
            }

            second.ToFile(tempPath);
            second = Instance.FromFile(tempPath);

            ComparisonReport report = null;

            string[]         expectedMessages = null;
            BasicComparisons basicSelection;

            // Full comparison outputs both Entity and Period from basic and detailed comparion
            report = InstanceComparer.Report(first, second, ComparisonTypes.All);
            Assert.False(report.Result);
            expectedMessages = new string[] {
                "Different Entity",
                "Different Period",
                $"(a) {first.Contexts[0].Entity}",
                $"(b) {second.Contexts[0].Entity}",
                $"(a) {first.Contexts[0].Period}",
                $"(b) {second.Contexts[0].Period}"
            };
            Assert.Equal(expectedMessages, report.Messages);//, report.Messages.Join(Environment.NewLine));

            // basic comparison with all flags reports Entity and Period
            basicSelection = BasicComparisons.All;
            report         = InstanceComparer.Report(first, second, ComparisonTypes.Basic);
            Assert.False(report.Result);
            expectedMessages = new string[] {
                "Different Entity",
                "Different Period",
            };
            Assert.Equal(expectedMessages, report.Messages);//, report.Messages.Join(Environment.NewLine));


            // basic comparison without Entity and Period flags does not list any differences
            basicSelection &= ~BasicComparisons.Entity;
            basicSelection &= ~BasicComparisons.Period;

            report = InstanceComparer.Report(first, second, ComparisonTypes.Basic, basicSelection);
            Assert.True(report.Result);
        }
예제 #3
0
        public void initialize(ISOMReportFile teamReportFile)
        {
            Console.WriteLine("    Building Under Usage...");
            if (teamComparisonReport == null)
            {
                teamComparisonReport = (ComparisonReport)teamReportFile.FindReport("LEAGUE", "Comparison Report");

                teamComparisonReport.processReport(Program.LEAGUES[0].Length);
            }
        }
예제 #4
0
 public void testHittersUsage()
 {
     Assert.AreEqual(75, ComparisonReport.getPlayerTargetUsage(50));
     Assert.AreEqual(178, ComparisonReport.getPlayerTargetUsage(119));
     Assert.AreEqual(180, ComparisonReport.getPlayerTargetUsage(120));
     Assert.AreEqual(181, ComparisonReport.getPlayerTargetUsage(121));
     Assert.AreEqual(659, ComparisonReport.getPlayerTargetUsage(599));
     Assert.AreEqual(660, ComparisonReport.getPlayerTargetUsage(600));
     Assert.AreEqual(661, ComparisonReport.getPlayerTargetUsage(601));
 }
예제 #5
0
 public void testPitchersUsage()
 {
     Assert.AreEqual(75, ComparisonReport.getPitcherTargetUsage(50));
     Assert.AreEqual(88, ComparisonReport.getPitcherTargetUsage(59));
     Assert.AreEqual(90, ComparisonReport.getPitcherTargetUsage(60));
     Assert.AreEqual(148, ComparisonReport.getPitcherTargetUsage(118));
     Assert.AreEqual(149, ComparisonReport.getPitcherTargetUsage(119));
     Assert.AreEqual(150, ComparisonReport.getPitcherTargetUsage(120));
     Assert.AreEqual(229, ComparisonReport.getPitcherTargetUsage(199));
     Assert.AreEqual(230, ComparisonReport.getPitcherTargetUsage(200));
 }
예제 #6
0
        private static TagsCorpus <TNER> GetReport(string etalon, string actual, out ComparisonReport <TNER> report)
        {
            var m = Worker.Parser.Parse(etalon);

            report = Worker.Parser.Parse(actual).Tags
                     .CompareTo(
                m.Tags,
                TagsMatchers <TNER> .Lenient,
                Worker.Values,
                Worker.Undefined);
            return(m);
        }
예제 #7
0
 private Report loadReport(string reportTitle)
 {
     if (reportTitle.StartsWith("LEAGUE STANDINGS"))
     {
         return(new LeagueStandingsReport(reportTitle, Program.LEAGUES[0].Length > 0));
     }
     if (reportTitle.StartsWith("LEAGUE GRAND TOTALS (primary report) FOR"))
     {
         return(new LeagueGrandTotalsReport(reportTitle));
     }
     else if (reportTitle.StartsWith("INJURY/MINOR LEAGUE REPORT FOR"))
     {
         return(new LineScoreAndMinorsReport(reportTitle));
     }
     else if (reportTitle.StartsWith("AWARDS VOTING FOR"))
     {
         return(new NewspaperStyleReport(reportTitle));
     }
     else if (reportTitle.StartsWith("RECORD BOOK FOR FOR"))
     {
         return(new RecordBookReport(reportTitle));
     }
     else if (reportTitle.StartsWith("Comparison Report"))
     {
         if (comparisonReport == null)
         {
             comparisonReport = new ComparisonReport(reportTitle, Config.config);
         }
         return(comparisonReport);
     }
     else if (reportTitle.StartsWith("Primary Player Statistics"))
     {
         if (primaryStatsReport == null)
         {
             primaryStatsReport = new PrimaryStatsReport(reportTitle, Config.config);
         }
         return(primaryStatsReport);
     }
     else
     {
         return(new Report(reportTitle));
     }
 }
예제 #8
0
        public void initialize(ISOMReportFile teamReportFile)
        {
            Console.WriteLine("    Building Comparison...");
            Console.WriteLine("      Showing Moral=" + Config.SHOW_MORAL + ", Showing Warnings=" + Config.SHOW_WARNING);

            teamPrimaryStatsReport = (PrimaryStatsReport)teamReportFile.FindReport("LEAGUE", "Primary Player Statistics For");
            teamPrimaryStatsReport.processReport(Program.LEAGUES[0].Length);
            List <Player> replayPlayers = teamPrimaryStatsReport.getPlayers();


            teamComparisonReport = (ComparisonReport)teamReportFile.FindReport("LEAGUE", "Comparison Report");
            if (teamComparisonReport == null)
            {
                System.Console.WriteLine("Are you sure you selected 'ALL REPORTS' for the Team Reports?");
                throw new Exception("Unable to find Comparison Report in the Team Report File");
            }
            teamComparisonReport.setPlayerActualData(replayPlayers);
            teamComparisonReport.processReport(Program.LEAGUES[0].Length);
        }
예제 #9
0
        private iTool IdentifyTool()
        {
            iTool toolToExecute = new NOP();

            switch (this.operation.ToLower())
            {
            case "activate features":
                toolToExecute = new ActivateFeatures();
                break;

            case "enable audit":
                toolToExecute = new EnableAudit();
                break;

            case "comparison report":
                toolToExecute = new ComparisonReport();
                break;

            case "import security":
                toolToExecute = new ImportSecurity();
                break;

            case "import alerts":
                toolToExecute = new ImportAlerts();
                break;

            case "enable email":
                toolToExecute = new EnableEmail();
                break;

            case "enable theme":
                toolToExecute = new EnableTheme();
                break;

            case "delete alerts":
                toolToExecute = new DeleteAlerts();
                break;
            }

            return(toolToExecute);
        }
예제 #10
0
 public void setReportData(ComparisonReport report)
 {
     teamComparisonReport = report;
 }
예제 #11
0
 public ActionResult GenerateComparisonReport(ComparisonReport request)
 {
     HostingEnvironment.QueueBackgroundWorkItem(ct => ReportsService.GenerateReport(request));
     return(new HttpStatusCodeResult(HttpStatusCode.OK));
 }
예제 #12
0
        private static List <Mismatch <TType> > AllErrors <TType>(ComparisonReport <TType> report)
        {
            var allErrors = report.Mismatches.SelectMany(p => p.Value).ToList();

            return(allErrors);
        }
예제 #13
0
        static void Main(string[] args)
        {
            //CHECK if args is correct
            if (args.Length < 3)
            {
                //Print help
                PrintHelp();
                return;
            }

            //CHECK for OPTIONS
            float tolerance = 0;

            foreach (var s in args)
            {
                if (s.Contains("--tolerance="))
                {
                    if (!float.TryParse(s.Substring(12), out tolerance))
                    {
                        Console.WriteLine("Invalid tolerance value.");
                        return;
                    }
                }
            }


            //CHECK if path is valid
            string img1path, img2path, outputpath;

            try
            {
                img1path   = Path.GetFullPath(args[0]);
                img2path   = Path.GetFullPath(args[1]);
                outputpath = Path.GetFullPath(args[2]);
            }
            catch (Exception e)
            {
                Console.WriteLine("Invalid Image Paths provided");
                throw;
            }

            //CHECK if image is same size
            Bitmap img1 = new Bitmap(img1path);
            Bitmap img2 = new Bitmap(img2path);

            if (img1.Height != img2.Height || img1.Width != img2.Width)
            {
                Console.WriteLine("Input images are of different width and height. Unable to compare");
                return;
            }



            //Execute Comparison
            ComparisonReport report = CompareImages(img1, img2, tolerance);
            string           html   = GenerateHTMLReport(img1path, img2path, outputpath, report);

            //Dump comparison output
            report.output.Save(outputpath);
            File.WriteAllText(outputpath + ".html", html);
        }
예제 #14
0
        private static string GenerateHTMLReport(string img1path, string img2path, string outputpath, ComparisonReport report)
        {
            string html = "<body>";

            html += $"<div style='width: 33.33%;display: inline-block;'><img src='{img1path}' style='width: 100%; height: auto'></div>";
            html += $"<div style='width: 33.33%;display: inline-block;'><img src='{outputpath}' style='width: 100%; height: auto'></div>";
            html += $"<div style='width: 33.33%;display: inline-block;'><img src='{img2path}' style='width: 100%; height: auto'></div>";
            html += $"<div>" +
                    $"<p>&Delta;E is the perceivable difference in color. A &Delta;E of 0 is mathematically exact. A &Delta;E of 1.0 to 2.0 is just noticeable.</p>" +
                    $"<table style='width:20em'>" +
                    $"<tr>" +
                    $"<td>Maximum &Delta;E</td>" +
                    $"<td>{report.maxDeltaE}</td>" +
                    $"</tr>" +
                    $"<tr>" +
                    $"<td>Minimum &Delta;E</td>" +
                    $"<td>{report.minDeltaE}</td>" +
                    $"</tr>" +
                    $"<tr>" +
                    $"<td>Average &Delta;E</td>" +
                    $"<td>{report.avgDeltaE}</td>" +
                    $"</tr>" +
                    $"</table></div>";

            html += "</body>";
            return(html);
        }