public void CategorySeriesCreatesCategoryXAxisForString()
 {
     var dataSource = new NullPowerShellDataSource();
     dataSource.Data.Add(new SolidPSObjectBase(new PSObject(new {Label = "Test", Value = 123})));
     ChartSeriesViewModel viewModel = new ChartSeriesViewModel
                                          {
                                              LabelMemberPath = "Label",
                                              ValueMemberPath = "Value",
                                              DataSource = dataSource,
                                              EnableConfigureAxes = true
                                          };
     var axis = viewModel.XAxis;
     Assert.NotNull( axis );
     Assert.Equal( ChartAxisType.CategoryX, axis.AxisType );
 }
        public void CategorySeriesCreatesCategoryXAxisForString()
        {
            var dataSource = new NullPowerShellDataSource();

            dataSource.Data.Add(new SolidPSObjectBase(new PSObject(new { Label = "Test", Value = 123 })));
            ChartSeriesViewModel viewModel = new ChartSeriesViewModel
            {
                LabelMemberPath     = "Label",
                ValueMemberPath     = "Value",
                DataSource          = dataSource,
                EnableConfigureAxes = true
            };
            var axis = viewModel.XAxis;

            Assert.NotNull(axis);
            Assert.Equal(ChartAxisType.CategoryX, axis.AxisType);
        }
        public void ScatterSeriesCreatesNumericXAxisForInteger()
        {
            var dataSource = new NullPowerShellDataSource();

            dataSource.Data.Add(new SolidPSObjectBase(new PSObject(new { Label = 5, Value = 123 })));
            ChartSeriesViewModel viewModel = new ChartSeriesViewModel
            {
                SeriesType          = ChartSeriesType.Scatter,
                XMemberPath         = "Label",
                YMemberPath         = "Value",
                DataSource          = dataSource,
                EnableConfigureAxes = true
            };
            var axis = viewModel.XAxis;

            Assert.NotNull(axis);
            Assert.Equal(ChartAxisType.NumericX, axis.AxisType);
        }
        public void ScatterSeriesThrowsWhenXAxisIsString()
        {
            var dataSource = new NullPowerShellDataSource();

            dataSource.Data.Add(new SolidPSObjectBase(new PSObject(new { Label = "ASDF", Value = 123 })));
            Assert.Throws <Exceptions.InvalidChartAxisTypeException>(() =>
            {
                ChartSeriesViewModel
                viewModel = new ChartSeriesViewModel
                {
                    SeriesType =
                        ChartSeriesType
                        .Scatter,
                    XMemberPath =
                        "Label",
                    YMemberPath =
                        "Value",
                    DataSource =
                        dataSource,
                    EnableConfigureAxes = true
                };
            }
                                                                     );
        }
        public void PolarSeriesCreatesNumericAngleXAxisForInteger()
        {
            var dataSource = new NullPowerShellDataSource();
            dataSource.Data.Add(new SolidPSObjectBase(new PSObject(new { Label = 5, Value = 123 })));
            ChartSeriesViewModel viewModel = new ChartSeriesViewModel
            {
                SeriesType = ChartSeriesType.PolarArea,
                AngleMemberPath = "Label",
                RadiusMemberPath = "Value",

                DataSource = dataSource,
                EnableConfigureAxes = true
            };
            var axis = viewModel.XAxis;
            Assert.NotNull(axis);
            Assert.Equal(ChartAxisType.NumericAngle, axis.AxisType);
        }
 public void ScatterSeriesThrowsWhenXAxisIsString()
 {
     var dataSource = new NullPowerShellDataSource();
     dataSource.Data.Add(new SolidPSObjectBase(new PSObject(new {Label = "ASDF", Value = 123})));
     Assert.Throws<Exceptions.InvalidChartAxisTypeException>(() =>
                                                                 {
                                                                     ChartSeriesViewModel
                                                                         viewModel = new ChartSeriesViewModel
                                                                                         {
                                                                                             SeriesType =
                                                                                                 ChartSeriesType
                                                                                                 .Scatter,
                                                                                             XMemberPath =
                                                                                                 "Label",
                                                                                             YMemberPath =
                                                                                                 "Value",
                                                                                             DataSource =
                                                                                                 dataSource,
                                                                                             EnableConfigureAxes = true
                                                                                         };
                                                                 }
         );
 }