Beispiel #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));
 }
 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);
 }
 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);
 }
        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);
        }
        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);
        }
        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);
        }
        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");
        }
Beispiel #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));
 }