Пример #1
0
		public void TestAllElementsAddRemove()
		{
			ChartPlotter plotter = new ChartPlotter();
			plotter.PerformLoad();

			var types = GetAllCharts();

			var withoutCtor = from type in types
							  let ctors = type.GetConstructors()
							  let noParameterlessCtor = (from c in ctors
														 let p = c.GetParameters()
														 select p).All(p => p.Length >= 1)
							  where noParameterlessCtor
							  select type;

			var plotterElements = new List<IPlotterElement>();
			plotter.Children.Clear();
			foreach (var type in types)
			{
				IPlotterElement element = (IPlotterElement)Activator.CreateInstance(type);
				plotterElements.Add(element);
				plotter.Children.Add(element);
			}

			foreach (var item in plotterElements)
			{
				Assert.AreEqual(plotter, item.Plotter);
			}

			plotter.Children.Clear();
			plotter.Wait(DispatcherPriority.Background);

			foreach (var item in plotterElements)
			{
				Assert.IsNull(item.Plotter, item.ToString());
			}
		}
Пример #2
0
		public void CheckThatSegmentHasNullPlotterAfterDisconnection()
		{
			ChartPlotter plotter = new ChartPlotter();
			Segment segment = new Segment();

			plotter.Children.Add(segment);
			plotter.PerformLoad();
			plotter.Wait(DispatcherPriority.Background);

			plotter.Children.Remove(segment);
			plotter.Wait(DispatcherPriority.Background);

			Assert.IsNull(segment.Plotter);
		}
Пример #3
0
		public void RemovingWhileViewportChange()
		{
			ChartPlotter plotter = new ChartPlotter();
			HorizontalAxis axis = new HorizontalAxis();
			plotter.Children.Add(axis);

			plotter.PerformLoad();

			plotter.Viewport.Visible = new DataRect(2, 3, 4, 5);
			plotter.Children.Remove(axis);

			plotter.Wait(DispatcherPriority.Background);
		}