Ejemplo n.º 1
0
        public void CreateBackgroundLayerStatus_InvalidImageBasedMapData_ThrowsNotSupportedException()
        {
            // Setup
            var mapData = new SimpleImageBasedMapData();

            // Call
            TestDelegate test = () => BackgroundLayerStatusFactory.CreateBackgroundLayerStatus(mapData);

            // Assert
            string message = Assert.Throws <NotSupportedException>(test).Message;

            Assert.AreEqual("Unsupported type of mapData", message);
        }
Ejemplo n.º 2
0
        public void Transparency_ValidValues_ReturnNewlySetValue(double newValue)
        {
            // Setup
            var mapData = new SimpleImageBasedMapData("A");
            int originalNumberOfDecimals = mapData.Transparency.NumberOfDecimalPlaces;

            // Call
            mapData.Transparency = (RoundedDouble)newValue;

            // Assert
            Assert.AreEqual(newValue, mapData.Transparency.Value);
            Assert.AreEqual(originalNumberOfDecimals, mapData.Transparency.NumberOfDecimalPlaces);
        }
Ejemplo n.º 3
0
        public void Transparency_SetInvalidValue_ThrowArgumentOutOfRangeException(double invalidTransparency)
        {
            // Setup
            var mapData = new SimpleImageBasedMapData("A");

            // Call
            TestDelegate call = () => mapData.Transparency = (RoundedDouble)invalidTransparency;

            // Assert
            const string message   = "De transparantie moet in het bereik [0,00, 1,00] liggen.";
            string       paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(call, message).ParamName;

            Assert.AreEqual("value", paramName);
        }
        public void HasSameConfiguration_MapDataNotWmtsMapData_ReturnFalse()
        {
            // Setup
            using (var layerStatus = new WmtsBackgroundLayerStatus())
            {
                var mapData = new SimpleImageBasedMapData();

                // Call
                bool isSame = layerStatus.HasSameConfiguration(mapData);

                // Assert
                Assert.IsFalse(isSame);
            }
        }
Ejemplo n.º 5
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            const string name = "A";

            // Call
            var mapData = new SimpleImageBasedMapData(name);

            // Assert
            Assert.IsInstanceOf <MapData>(mapData);
            Assert.AreEqual(name, mapData.Name);
            Assert.IsTrue(mapData.IsVisible);
            Assert.IsFalse(mapData.IsConfigured);

            Assert.AreEqual(2, mapData.Transparency.NumberOfDecimalPlaces);
            Assert.AreEqual(0, mapData.Transparency.Value);
        }
        public void LayerInitializationSuccessful_MapDataNotWmtsMapData_SetCreationFailedTrue()
        {
            // Setup
            var            mocks         = new MockRepository();
            var            tileFetcher   = mocks.Stub <ITileFetcher>();
            IConfiguration configuration = CreateStubConfiguration(mocks, tileFetcher);

            mocks.ReplayAll();

            using (var layer = new BruTileLayer(configuration))
                using (var layerStatus = new WmtsBackgroundLayerStatus())
                {
                    var mapData = new SimpleImageBasedMapData();

                    // Call
                    layerStatus.LayerInitializationSuccessful(layer, mapData);

                    // Assert
                    Assert.IsTrue(layerStatus.PreviousBackgroundLayerCreationFailed);
                }
        }