Exemplo n.º 1
0
        public static IEnumerable <IEnumerable <object> > GetFormatterTestCaseGenerator()
        {
            IReportFormatter jsonFormatter = new JsonReportFormatter();
            IReportFormatter xmlFormatter  = new XmlReportFormatter();

            yield return(new object[]
            {
                new Dictionary <string, IReportFormatter> {
                    { "json", jsonFormatter }
                },
                "json",
                jsonFormatter
            });

            yield return(new object[]
            {
                new Dictionary <string, IReportFormatter> {
                    { "json", jsonFormatter }, { "xml", xmlFormatter }
                },
                "json",
                jsonFormatter
            });

            yield return(new object[]
            {
                new Dictionary <string, IReportFormatter> {
                    { "json", jsonFormatter }, { "xml", xmlFormatter }
                },
                "xml",
                xmlFormatter
            });
        }
        public void Can_serialize_metrics_with_changes()
        {
            var name  = new MetricName(typeof(MeterTests), "Can_serialize_metrics_with_changes");
            var meter = Metrics.Meter(typeof(MeterTests), "Can_serialize_metrics_with_changes", "test", TimeUnit.Seconds);

            Assert.IsNotNull(Metrics.All[name], "Metric not found in central registry");

            meter.Mark(3);

            var reporter = new JsonReportFormatter();
            var json     = reporter.GetSample();

            Console.WriteLine(json);
        }