示例#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)));
        }
        public void MapRouteViewModel_Initialize_CorrectRoute()
        {
            var data  = Factories.GetRouteData();
            var model = new MapRouteViewModel(data);

            model.Initialize();

            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 = data.Route;

            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)));
        }