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(); }
public void Constructor_ExpectedValues() { // Call using (var layerStatus = new MapControlBackgroundLayerStatus()) { // Assert Assert.IsInstanceOf <BackgroundLayerStatus>(layerStatus); Assert.IsNull(layerStatus.BackgroundLayer); Assert.IsFalse(layerStatus.PreviousBackgroundLayerCreationFailed); } }
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); } }
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)); } }
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)); } }