Beispiel #1
0
        public void ObservableCollection()
        {
            Chart chart = new Chart();

            chart.Width  = 400;
            chart.Height = 300;

            _isLoaded = false;
            Common.CreateAndAddDefaultDataSeries(chart);

            TitleTest titleTest       = new TitleTest();
            bool      changedObserved = false;

            foreach (Title title in titleTest.TitlesToTest)
            {
                chart.Titles.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
                {
                    changedObserved = true;
                    Assert.AreEqual(System.Collections.Specialized.NotifyCollectionChangedAction.Add, e.Action);
                    Assert.AreEqual(1, e.NewItems.Count);
                    Assert.AreEqual(new FontFamily("Trebuchet MS"), title.FontFamily);
                };

                title.FontFamily = new FontFamily("Trebuchet MS");
                chart.Titles.Add(title);

                chart.Loaded += new RoutedEventHandler(chart_Loaded);

                Window window = new Window();
                window.Content = chart;
                window.Show();
                if (_isLoaded)
                {
                    Assert.IsTrue(changedObserved, "The event handler did not fire");
                }

                window.Dispatcher.InvokeShutdown();
                window.Close();
            }
        }
Beispiel #2
0
        public void ObservableCollection()
        {
            Chart chart = new Chart();
            chart.Width = 400;
            chart.Height = 300;

            _isLoaded = false;
            Common.CreateAndAddDefaultDataSeries(chart);

            TitleTest titleTest = new TitleTest();
            bool changedObserved = false;
            foreach (Title title in titleTest.TitlesToTest)
            {
                chart.Titles.CollectionChanged += delegate(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
                {
                    changedObserved = true;
                    Assert.AreEqual(System.Collections.Specialized.NotifyCollectionChangedAction.Add, e.Action);
                    Assert.AreEqual(1, e.NewItems.Count);
                    Assert.AreEqual(new FontFamily("Trebuchet MS"), title.FontFamily);
                };

                title.FontFamily = new FontFamily("Trebuchet MS");
                chart.Titles.Add(title);

                chart.Loaded += new RoutedEventHandler(chart_Loaded);

                Window window = new Window();
                window.Content = chart;
                window.Show();
                if (_isLoaded)
                    Assert.IsTrue(changedObserved, "The event handler did not fire");

                window.Dispatcher.InvokeShutdown();
                window.Close();
            }
        }