コード例 #1
0
        public void HasSameConfiguration_LayerInitializedSameMapDataType_ReturnFalse(ImageBasedMapData mapData1, ImageBasedMapData mapData2)
        {
            // Setup
            var            mocks         = new MockRepository();
            var            tileFetcher   = mocks.Stub <ITileFetcher>();
            IConfiguration configuration = CreateStubConfiguration(mocks, tileFetcher);

            mocks.ReplayAll();

            using (var layerStatus = new MapControlBackgroundLayerStatus())
            {
                using (var layer = new BruTileLayer(configuration))
                {
                    layerStatus.LayerInitializationSuccessful(layer, mapData1);

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

                    // Assert
                    Assert.IsTrue(isSame, "Should recognize same configuration even if instance is not the same.");
                }
            }

            mocks.VerifyAll();
        }
コード例 #2
0
        public void Constructor_ExpectedValues()
        {
            // Call
            using (var layerStatus = new MapControlBackgroundLayerStatus())
            {
                // Assert
                Assert.IsInstanceOf <BackgroundLayerStatus>(layerStatus);

                Assert.IsNull(layerStatus.BackgroundLayer);
                Assert.IsFalse(layerStatus.PreviousBackgroundLayerCreationFailed);
            }
        }
コード例 #3
0
        public void HasSameConfiguration_LayerNotInitialized_ReturnFalse()
        {
            // Setup
            using (var layerStatus = new MapControlBackgroundLayerStatus())
            {
                var mapData = new TestImageBasedMapData("test", true);

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

                // Assert
                Assert.IsFalse(isSame);
            }
        }
コード例 #4
0
        public void ClearConfiguration_WithFailedLayerInitializationAndExpectingRecreation_ConfigurationClearedButKeepFailedFlagSet(ImageBasedMapData mapData)
        {
            // Setup
            using (var layerStatus = new MapControlBackgroundLayerStatus())
            {
                layerStatus.LayerInitializationFailed();

                // Call
                layerStatus.ClearConfiguration(true);

                // Assert
                Assert.IsTrue(layerStatus.PreviousBackgroundLayerCreationFailed);
                Assert.IsFalse(layerStatus.HasSameConfiguration(mapData));
            }
        }
コード例 #5
0
        public void ClearConfiguration_HasLayer_ConfigurationCleared(ImageBasedMapData mapData)
        {
            // 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 MapControlBackgroundLayerStatus())
                {
                    layerStatus.LayerInitializationSuccessful(layer, mapData);

                    // Call
                    layerStatus.ClearConfiguration();

                    // Assert
                    Assert.IsFalse(layerStatus.PreviousBackgroundLayerCreationFailed);
                    Assert.IsFalse(layerStatus.HasSameConfiguration(mapData));
                }
        }