src/GenFx.Wpf.Tests/MetricsChartTest.cs
/// <summary>
/// Tests that the chart refreshes the series when the <see cref="MetricsChart.SelectedMetrics"/> property changes.
/// </summary>
Tests that the chart refreshes the series when the  property changes.
Tests that the chart refreshes the series when the property changes .
[StaFact]
        public void MetricsChart_OnSelectedMetricsChanged()
        {
            TestPopulation population = new TestPopulation();
            TestAlgorithm algorithm = new TestAlgorithm();
            Metric metric1 = Mock.Of<Metric>();
            List<MetricResult> metric1Results = new List<MetricResult>
            {
                new MetricResult(0, 0, 3, metric1),
                new MetricResult(0, 1, 4, metric1)
            };
            metric1.GetResults(0).AddRange(metric1Results);
            algorithm.Metrics.Add(metric1);
            Metric metric2 = Mock.Of<Metric>();
            List<MetricResult> metric2Results = new List<MetricResult>
            {
                new MetricResult(0, 0, 3, metric1),
                new MetricResult(0, 1, 4, metric1)
            };
            metric2.GetResults(0).AddRange(metric2Results);
            algorithm.Metrics.Add(metric2);
            MetricsChart chart = new MetricsChart
            {
                Algorithm = algorithm,
                Population = population
            };
            Assert.Equal(2, chart.PlotModel.Series.Count);
            chart.PlotModel.Series.Clear();
            chart.SelectedMetrics = new List<Metric> { algorithm.Metrics[0] };
            Assert.Single(chart.PlotModel.Series);
        }
[ StaFact ] public void MetricsChart_OnSelectedMetricsChanged ( ) { TestPopulation population = new TestPopulation ( ) ; TestAlgorithm algorithm = new TestAlgorithm ( ) ; Metric metric1 = Mock . Of < Metric > ( ) ; List < MetricResult > metric1Results = new List < MetricResult > { new MetricResult ( 0 , 0 , 3 , metric1 ) , new MetricResult ( 0 , 1 , 4 , metric1 ) } ; metric1 . GetResults ( 0 ) . AddRange ( metric1Results ) ; algorithm . Metrics . Add ( metric1 ) ; Metric metric2 = Mock . Of < Metric > ( ) ; List < MetricResult > metric2Results = new List < MetricResult > { new MetricResult ( 0 , 0 , 3 , metric1 ) , new MetricResult ( 0 , 1 , 4 , metric1 ) } ; metric2 . GetResults ( 0 ) . AddRange ( metric2Results ) ; algorithm . Metrics . Add ( metric2 ) ; MetricsChart chart = new MetricsChart { Algorithm = algorithm , Population = population } ; Assert . Equal ( 2 , chart . PlotModel . Series . Count ) ; chart . PlotModel . Series . Clear ( ) ; chart . SelectedMetrics = new List < Metric > { algorithm . Metrics [ 0 ] } ; Assert . Single ( chart . PlotModel . Series ) ; }
Tests that the chart refreshes the series when the  property changes.
Tests that the chart refreshes the series when the property changes .