Пример #1
0
 public static IDataView Create(IApplicationController applicationController, IDataProviderService provider, IBufferedDrawingService bufferedDrawingService)
 {
     TestFactory.CreateBaseServices(applicationController, provider,
                                    out IGridState gridState, out IDataDrawState graphState,
                                    out IItemFormatter itemFormatter, out IMargin margin,
                                    out IDataService dataService, out IScaleService scaleService, ref bufferedDrawingService);
     return(new DataView(scaleService, dataService));
 }
Пример #2
0
 public void ScaleToScreenYTest()
 {
     TestFactory.CreateBaseServices(null, null,
                                    out IGridState gridState, out IDataDrawState graphState,
                                    out IItemFormatter itemFormatter, out IMargin margin,
                                    out IDataService dataService, out IScaleService scaleService);
     Assert.IsTrue(scaleService.ScaleToScreenY(0) == 0);
     Assert.IsTrue(scaleService.ScaleToScreenY(.5) == .5 * scaleService.State.ScaleY);
 }
Пример #3
0
 public void ToScreenYTest()
 {
     TestFactory.CreateBaseServices(null, null,
                                    out IGridState gridState, out IDataDrawState graphState,
                                    out IItemFormatter itemFormatter, out IMargin margin,
                                    out IDataService dataService, out IScaleService scaleService);
     Assert.IsTrue(scaleService.ToScreen(Axis.Y, 0) == (0 - scaleService.State.Y1) * scaleService.State.ScaleY);
     Assert.IsTrue(scaleService.ToScreen(Axis.Y, .5) == (.5 - scaleService.State.Y1) * scaleService.State.ScaleY);
 }
Пример #4
0
        public void ScaleToScreenXTest()
        {
            TestFactory.CreateBaseServices(null, null,
                                           out IGridState gridState, out IDataDrawState graphState,
                                           out IItemFormatter itemFormatter, out IMargin margin,
                                           out IDataService dataService, out IScaleService scaleService);
            double x = new DateTime(1985, 6, 23).Ticks / TimeSpan.TicksPerMillisecond;

            Assert.IsTrue(scaleService.ScaleToScreenX(0) == 0);
            Assert.IsTrue(scaleService.ScaleToScreenX(x) == x * scaleService.State.ScaleX);
        }
Пример #5
0
        public void SetStepYTest()
        {
            TestFactory.CreateBaseServices(null, null,
                                           out IGridState gridState, out IDataDrawState graphState,
                                           out IItemFormatter itemFormatter, out IMargin margin,
                                           out IDataService dataService, out IScaleService scaleService);

            double step = 0;

            step = 0;       scaleService.SetStepY(step); Assert.IsTrue(step == scaleService.State.StepY);
            step = 0.125;   scaleService.SetStepY(step); Assert.IsTrue(step == scaleService.State.StepY);
        }
Пример #6
0
        public void ToScreenTest()
        {
            TestFactory.CreateBaseServices(null, null,
                                           out IGridState gridState, out IDataDrawState graphState,
                                           out IItemFormatter itemFormatter, out IMargin margin,
                                           out IDataService dataService, out IScaleService scaleService);
            double x = new DateTime(1985, 6, 23).Ticks / TimeSpan.TicksPerMillisecond;

            Assert.IsTrue(scaleService.ToScreen(Axis.X, 0) == (0 - scaleService.State.X1) * scaleService.State.ScaleX);
            Assert.IsTrue(scaleService.ToScreen(Axis.X, x) == (x - scaleService.State.X1) * scaleService.State.ScaleX);

            Assert.IsTrue(scaleService.ToScreen(Axis.Y, 0) == (0 - scaleService.State.Y1) * scaleService.State.ScaleY);
            Assert.IsTrue(scaleService.ToScreen(Axis.Y, .5) == (.5 - scaleService.State.Y1) * scaleService.State.ScaleY);
        }
Пример #7
0
        public void ZoomAndUnzoomTest()
        {
            var controller = TestFactory.CreateApplicationController();

            TestFactory.CreateBaseServices(controller, null,
                                           out IGridState gridState, out IDataDrawState graphState,
                                           out IItemFormatter itemFormatter, out IMargin margin,
                                           out IDataService dataService, out IScaleService scaleService);

            int iterations = 100000;
            var state      = new ScaleState(scaleService.State);

            for (int i = 0; i < iterations; i++)
            {
                scaleService.Zoom(-120);
            }
            for (int i = 0; i < iterations && !state.Equals(scaleService.State); i++)
            {
                scaleService.Zoom(-120);
            }
            Assert.IsTrue(state.Equals(scaleService.State), $"State before zooming/unzooming not the same as before");
        }
Пример #8
0
 public static IDataView Create(int testPointsNumber)
 {
     TestFactory.CreateBaseServices(testPointsNumber, out IGridState gridState, out IDataDrawState graphState, out IDataService dataService, out IScaleService scaleService);
     return(new DataView(scaleService, dataService));
 }