public void NumericColumnIsRightJustified()
        {
            var config  = ManualConfig.Create(DefaultConfig.Instance).With(StatisticColumn.Mean);
            var summary = MockFactory.CreateSummary(config);
            var table   = new SummaryTable(summary);

            Assert.Equal(SummaryTable.SummaryTableColumn.TextJustification.Right, table.Columns.First(c => c.Header == "Mean").Justify);
        }
        public void TextColumnIsLeftJustified()
        {
            var config  = ManualConfig.Create(DefaultConfig.Instance).With(new ParamColumn("Param"));
            var summary = MockFactory.CreateSummary(config);
            var table   = new SummaryTable(summary);

            Assert.Equal(SummaryTable.SummaryTableColumn.TextJustification.Left, table.Columns.First(c => c.Header == "Param").Justify);
        }
Esempio n. 3
0
        private Summary CreateSummary(IConfig config)
        {
            var logger  = new AccumulationLogger();
            var summary = MockFactory.CreateSummary(config);

            MarkdownExporter.Default.ExportToLog(summary, logger);
            output.WriteLine(logger.GetLog());
            return(summary);
        }
        // TODO: Union this with MockFactory
        private Summary CreateSummary(bool hugeSd, Metric[] metrics)
        {
            var logger  = new AccumulationLogger();
            var summary = MockFactory.CreateSummary <MockBenchmarkClass>(DefaultConfig.Instance, hugeSd, metrics);

            MarkdownExporter.Default.ExportToLog(summary, logger);
            output.WriteLine(logger.GetLog());
            return(summary);
        }
        [Fact] // Issue #1070
        public void CustomOrdererIsSupported()
        {
            var config = ManualConfig.Create(DefaultConfig.Instance)
                         .WithOrderer(new DefaultOrderer(SummaryOrderPolicy.FastestToSlowest, MethodOrderPolicy.Alphabetical));
            var summary = MockFactory.CreateSummary(config);

            Assert.True(summary.Orderer is DefaultOrderer defaultOrderer &&
                        defaultOrderer.SummaryOrderPolicy == SummaryOrderPolicy.FastestToSlowest &&
                        defaultOrderer.MethodOrderPolicy == MethodOrderPolicy.Alphabetical);
        }
        private SummaryTable CreateTable()
        {
            var logger  = new AccumulationLogger();
            var config  = DefaultConfig.Instance;
            var summary = MockFactory.CreateSummary(config);
            var table   = new SummaryTable(summary);

            MarkdownExporter.Default.ExportToLog(summary, logger);
            output.WriteLine(logger.GetLog());
            return(table);
        }
        [Fact] // Issue #1168
        public void ZeroValueInMetricColumnIsDashedByDefault()
        {
            // arrange
            var config  = ManualConfig.Create(DefaultConfig.Instance);
            var metrics = new[] { new Metric(new FakeMetricDescriptor("metric1", "some legend", "0.0"), 0.0) };

            // act
            var summary = MockFactory.CreateSummary(config, hugeSd: false, metrics);
            var table   = new SummaryTable(summary);
            var actual  = table.Columns.First(c => c.Header == "metric1").Content;

            // assert
            Assert.True(actual.All(value => "-" == value));
        }
        public void Exporters(CultureInfo cultureInfo)
        {
            NamerFactory.AdditionalInformation  = $"{GetName(cultureInfo)}";
            Thread.CurrentThread.CurrentCulture = cultureInfo;

            var logger = new AccumulationLogger();

            var exporters = GetExporters();

            foreach (var exporter in exporters)
            {
                PrintTitle(logger, exporter);
                exporter.ExportToLog(MockFactory.CreateSummary(config), logger);
            }

            Approvals.Verify(logger.GetLog());
        }
Esempio n. 9
0
        public void Exporters(string cultureInfoName)
        {
            var cultureInfo = CultureInfos[cultureInfoName];

            NamerFactory.AdditionalInformation  = $"{GetName(cultureInfo)}";
            Thread.CurrentThread.CurrentCulture = cultureInfo;

            var logger = new AccumulationLogger();

            var exporters = GetExporters();

            foreach (var exporter in exporters)
            {
                PrintTitle(logger, exporter);
                exporter.ExportToLog(MockFactory.CreateSummary(config.WithCultureInfo(cultureInfo)), logger);
            }

            Approvals.Verify(logger.GetLog(), x => x.Replace("\r", string.Empty));
        }