public void LayerInitializationSuccessful_InitializationPreviouslyFailed_PreviousBackgroundLayerCreationFailedFalse() { // 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()) { layerStatus.LayerInitializationFailed(); // Precondition Assert.IsTrue(layerStatus.PreviousBackgroundLayerCreationFailed); WmtsMapData mapData = WmtsMapDataTestHelper.CreateDefaultPdokMapData(); // Call layerStatus.LayerInitializationSuccessful(layer, mapData); // Assert Assert.IsFalse(layerStatus.PreviousBackgroundLayerCreationFailed); } }
public void HasSameConfiguration_ForDifferentInitializedLayer_ReturnFalse(WmtsMapData otherData) { // Setup var mocks = new MockRepository(); var tileFetcher = mocks.Stub <ITileFetcher>(); using (var layerStatus = new WmtsBackgroundLayerStatus()) { IConfiguration configuration = CreateStubConfiguration(mocks, tileFetcher); mocks.ReplayAll(); using (var layer = new BruTileLayer(configuration)) { WmtsMapData mapData = WmtsMapDataTestHelper.CreateDefaultPdokMapData(); layerStatus.LayerInitializationSuccessful(layer, mapData); // Call bool isSame = layerStatus.HasSameConfiguration(otherData); // Assert Assert.IsFalse(isSame); } } mocks.VerifyAll(); }
public void HasSameConfiguration_ForInitializedLayer_ReturnTrue() { // Setup var mocks = new MockRepository(); var tileFetcher = mocks.Stub <ITileFetcher>(); using (var layerStatus = new WmtsBackgroundLayerStatus()) { IConfiguration configuration = CreateStubConfiguration(mocks, tileFetcher); mocks.ReplayAll(); using (var layer = new BruTileLayer(configuration)) { WmtsMapData mapData1 = WmtsMapDataTestHelper.CreateDefaultPdokMapData(); WmtsMapData mapData2 = WmtsMapDataTestHelper.CreateDefaultPdokMapData(); 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(); }
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); } }