Ejemplo n.º 1
0
        public void Map_TileAsyncAddedToReplacedCollection_FiresMapNewtileAvailable(LayerCollectionType collectionType)
        {
            var map = new Map();

            var group = CreateLayerGroup();
            map.GetCollection(collectionType).Add(group);

            group.Layers = new ObservableCollection<ILayer>();

            var tileAsync = CreateTileAsyncLayer();
            AddTileLayerToLayerGroup(tileAsync, group);

            var eventSource = map.GetMapNewTileAvailableAsObservable();
            RaiseMapNewtileAvailableOn(tileAsync);
            Assert.That(eventSource.Count().First(), Is.EqualTo(1), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 2
0
        public void Map_TileAsyncAddedToDetachedCollection_DoesNotFireMapNewTileAvailable(LayerCollectionType collectionType)
        {
            var map = new Map();

            var group = CreateLayerGroup();
            map.GetCollection(collectionType).Add(group);

            var detachedCollection = group.Layers;

            group.Layers = new ObservableCollection<ILayer>();

            var tileAsync = CreateTileAsyncLayer();
            detachedCollection.Add(tileAsync.Item1.Object);

            var eventSource = map.GetMapNewTileAvailableAsObservable();
            RaiseMapNewtileAvailableOn(tileAsync);
            Assert.That(eventSource.Count().First(), Is.EqualTo(0), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 3
0
        public void Map_TileAsyncFromClearedGroup_DoesNotFireMapNewTileAvailable(LayerCollectionType collectionType)
        {
            var map = new Map();

            var group = CreateLayerGroup();
            map.GetCollection(collectionType).Add(group);

            var tileLayer = CreateTileAsyncLayer();
            AddTileLayerToLayerGroup(tileLayer, group);

            group.Layers.Clear();

            var eventSource = map.GetMapNewTileAvailableAsObservable();
            RaiseMapNewtileAvailableOn(tileLayer);

            Assert.That(eventSource.IsEmpty().First(), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 4
0
        public void Map_TileAsyncRemovedFromNephew_DoesNotFireMapNewtileAvailable(LayerCollectionType collectionType)
        {
            var map = new Map();

            var group = CreateLayerGroup();
            map.GetCollection(collectionType).Add(group);

            var subGroup = CreateLayerGroup("subgroup");

            var tileAsyncLayer = CreateTileAsyncLayer();
            AddTileLayerToLayerGroup(tileAsyncLayer, subGroup);

            group.Layers.Add(subGroup);

            // test
            RemoveTileLayerFromGroup(subGroup, tileAsyncLayer);

            var eventSource = map.GetMapNewTileAvailableAsObservable();
            RaiseMapNewtileAvailableOn(tileAsyncLayer);
            Assert.That(eventSource.Count().First(), Is.EqualTo(0), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 5
0
        public void Map_TileAsyncReplacedFromGroup_DoesNotFireMapNewTileAvailable(LayerCollectionType collectionType)
        {
            var map = new Map();

            var group = CreateLayerGroup();
            map.GetCollection(collectionType).Add(group);

            var tileLayer = CreateTileAsyncLayer();
            AddTileLayerToLayerGroup(tileLayer, group);

            var newTileLayer = CreateTileAsyncLayer();
            ReplaceExistingAsyncLayerFromGroup(group, tileLayer, newTileLayer);

            var eventSource = map.GetMapNewTileAvailableAsObservable();
            RaiseMapNewtileAvailableOn(tileLayer);

            Assert.That(eventSource.IsEmpty().First(),
                "Map should NOT fire MapNewTileAvailable event for TileAsyncLayers replaced from a group");

            RaiseMapNewtileAvailableOn(newTileLayer);

            Assert.That(eventSource.Count().First(), Is.EqualTo(1), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 6
0
        public void MapDoesNoGenerateMapNewTile_AfterClear(LayerCollectionType collectionType)
        {
            var map = new Map();

            var tileAsyncLayer = CreateTileAsyncLayer();

            AddTileLayerToMap(tileAsyncLayer, map, collectionType);

            var eventSource = map.GetMapNewTileAvailableAsObservable();

            map.GetCollection(collectionType).Clear();

            RaiseMapNewtileAvailableOn(tileAsyncLayer);

            Assert.That(eventSource.IsEmpty().First(), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 7
0
        public void MapGeneratesMapNewTile_NewReplacedLayers(LayerCollectionType collectionType)
        {
            var map = new Map();

            var tileAsyncLayer = CreateTileAsyncLayer();

            AddTileLayerToMap(tileAsyncLayer, map, collectionType);

            var eventSource = map.GetMapNewTileAvailableAsObservable();

            var newLayer = CreateTileAsyncLayer();
            map.GetCollection(collectionType)[0] = newLayer.Item1.Object;

            RaiseMapNewtileAvailableOn(newLayer);

            Assert.That(eventSource.Count().First(), Is.EqualTo(1), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 8
0
        public void AfterRemovingTileAsyncLayer_MapDoesNotHookAnymoreItsMapNewTileAvailableEvent(LayerCollectionType collectionType)
        {
            var map = new Map();

            var tileAsyncLayer = CreateTileAsyncLayer();

            AddTileLayerToMap(tileAsyncLayer, map, collectionType);

            var eventSource = map.GetMapNewTileAvailableAsObservable();

            map.GetCollection(collectionType).RemoveAt(0); 

            RaiseMapNewtileAvailableOn(tileAsyncLayer);

            Assert.That(eventSource.Count().First(), Is.EqualTo(0), TestContext.CurrentContext.Test.GetDescription());
        }
Ejemplo n.º 9
0
        public void AddingTileAsyncLayers_HookItsMapNewTileAvaliableEvent(LayerCollectionType collectionType)
        {
            var map = new Map();

            var layer = CreateTileAsyncLayer();

            AddTileLayerToMap(layer, map, collectionType);
            
            var eventSource = map.GetMapNewTileAvailableAsObservable();

            RaiseMapNewtileAvailableOn(layer);
            
            Assert.That(eventSource.Count().First(), Is.EqualTo(1), TestContext.CurrentContext.Test.GetDescription());
        }