Ejemplo n.º 1
0
        public void GivenMapLineDataLayer_WhenUpdatedAfterMapLineDataFeaturesChanged_MapLineDataLayerFeaturesChanged()
        {
            // Given
            var mapLineData = new MapLineData("Test name")
            {
                Features = new[]
                {
                    CreateTestMapFeature()
                }
            };

            var mapLineDataLayer = new MapLineDataLayer(mapLineData);

            IFeature[] drawnFeatures = mapLineDataLayer.DataSet.Features.ToArray();

            // When
            mapLineData.Features = new[]
            {
                CreateTestMapFeature()
            };
            mapLineDataLayer.Update();

            // Then
            CollectionAssert.AreNotEqual(drawnFeatures, mapLineDataLayer.DataSet.Features);
        }
Ejemplo n.º 2
0
        private static void AssertMapLineDataLayerDefaultProperties(MapLineDataLayer mapLineDataLayer)
        {
            Assert.AreEqual("Test name", mapLineDataLayer.Name);
            Assert.IsTrue(mapLineDataLayer.IsVisible);
            Assert.IsFalse(mapLineDataLayer.ShowLabels);

            Assert.IsNotNull(mapLineDataLayer.LabelLayer);
            Assert.IsNull(mapLineDataLayer.LabelLayer.Symbology.Categories[0].Expression);

            var firstStroke = (SimpleStroke)mapLineDataLayer.Symbolizer.Strokes[0];

            Assert.AreEqual(2.0, firstStroke.Width);
            Assert.AreEqual(DashStyle.DashDot, firstStroke.DashStyle);

            Assert.AreEqual(0, mapLineDataLayer.DataSet.Features.Count);
        }
Ejemplo n.º 3
0
        private static void AssertMapLineDataLayerTestProperties(MapLineDataLayer mapLineDataLayer)
        {
            Assert.AreEqual("Another test name", mapLineDataLayer.Name);
            Assert.IsFalse(mapLineDataLayer.IsVisible);
            Assert.IsTrue(mapLineDataLayer.ShowLabels);

            Assert.IsNotNull(mapLineDataLayer.LabelLayer);
            Assert.AreEqual("[2]", mapLineDataLayer.LabelLayer.Symbology.Categories[0].Expression);

            var firstStroke = (CartographicStroke)mapLineDataLayer.Symbolizer.Strokes[0];

            Assert.AreEqual(Color.AliceBlue, firstStroke.Color);
            Assert.AreEqual(2, firstStroke.Width);
            Assert.AreEqual(DashStyle.DashDot, firstStroke.DashStyle);

            Assert.AreEqual(1, mapLineDataLayer.DataSet.Features.Count);
        }
Ejemplo n.º 4
0
        public void Constructor_MapLineDataWithTestProperties_MapLineDataLayerCreatedAccordingly()
        {
            // Setup
            var mapLineData = new MapLineData("Test name", new LineStyle
            {
                Color     = Color.AliceBlue,
                Width     = 2,
                DashStyle = LineDashStyle.DashDot
            });

            SetMapLineDataTestProperties(mapLineData);

            // Call
            var mapLineDataLayer = new MapLineDataLayer(mapLineData);

            // Assert
            Assert.IsInstanceOf <MapLineLayer>(mapLineDataLayer);
            Assert.IsInstanceOf <IFeatureBasedMapDataLayer>(mapLineDataLayer);
            AssertMapLineDataLayerTestProperties(mapLineDataLayer);
            Assert.AreEqual(KnownCoordinateSystems.Projected.NationalGrids.Rijksdriehoekstelsel, mapLineDataLayer.Projection);
        }
Ejemplo n.º 5
0
        public void Update_MapLineDataWithTestProperties_MapLineDataLayerUpdatedAccordingly()
        {
            // Setup
            var mapLineData = new MapLineData("Test name", new LineStyle
            {
                Color     = Color.AliceBlue,
                Width     = 2,
                DashStyle = LineDashStyle.DashDot
            });
            var mapLineDataLayer = new MapLineDataLayer(mapLineData);

            SetMapLineDataTestProperties(mapLineData);

            // Precondition
            AssertMapLineDataLayerDefaultProperties(mapLineDataLayer);

            // Call
            mapLineDataLayer.Update();

            // Assert
            AssertMapLineDataLayerTestProperties(mapLineDataLayer);
        }