예제 #1
0
        public void MapTimedViewModel_Initialize_CorrectRoute()
        {
            var data  = Factories.GetRouteData();
            var model = new MapTimedViewModel(data);

            model.Initialize();
            model.SliderValueChanged(2);

            List <Microsoft.Maps.MapControl.WPF.MapPolyline> locations = new List <Microsoft.Maps.MapControl.WPF.MapPolyline>();
            var arrow = new Microsoft.Maps.MapControl.WPF.MapPolyline();
            var line  = new Microsoft.Maps.MapControl.WPF.MapPolyline();

            Setup(line);

            line.Locations = new LocationCollection();

            for (int i = 0; i < 2; i++)
            {
                var loc = data.Route.ElementAt(i);
                line.Locations.Add(new Location(loc));
            }

            arrow = GetArrow(data.Route.First(), data.Route.ElementAt(1));

            locations.Add(line);
            locations.Add(arrow);

            Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(0), model.MapPolylines.ElementAt(0)));
            Assert.IsTrue(CompareMapPolylines.compare(locations.ElementAt(1), model.MapPolylines.ElementAt(1)));
        }
예제 #2
0
        public void MapTimedViewModel_Initialize_CorrectMapZoomLevel()
        {
            var data  = Factories.GetRouteData();
            var model = new MapTimedViewModel(data);

            model.Initialize();

            Assert.AreEqual(12.6d, Math.Round(model.MapZoomLevel, 1));
        }
예제 #3
0
        public void MapTimedViewModel_Initialize_CorrectAPIKey()
        {
            var data  = Factories.GetRouteData();
            var model = new MapTimedViewModel(data);

            model.Initialize();

            Assert.AreEqual(new ApplicationIdCredentialsProvider("FRANZ-OTTO").ToString(), model.APIKey.ToString());
        }
예제 #4
0
        public void MapTimedViewModel_Initialize_CorrectMapCenter()
        {
            var data  = Factories.GetRouteData();
            var model = new MapTimedViewModel(data);

            model.Initialize();

            Assert.AreEqual(new Location(0, 0), model.MapCenter);
        }
예제 #5
0
        /// <summary>
        /// This is the constructor of the MapTimed page
        /// </summary>
        /// <param name="data"></param>
        public MapTimed(DataProvider data)
        {
            InitializeComponent();

            model            = new MapTimedViewModel(data);
            this.DataContext = model;

            model.RouteChangedEvent += Model_RouteChangedEvent;

            model.Initialize();

            map.SetView(model.MapCenter, model.MapZoomLevel);
        }