public void GetTile_WhenTilePresent_ShouldReturnTile()
        {
            // arrange
            var tileCache = new FileCache(".", "png", new TimeSpan(long.MaxValue));

            tileCache.Add(new TileIndex(4, 5, "8"), new byte[243]);
            var fileTileProvider = new FileTileProvider(".", "png", new TimeSpan(long.MaxValue));

            // act
            var tile = fileTileProvider.GetTile(new TileInfo {
                Index = new TileIndex(4, 5, "8")
            });

            // assert
            Assert.AreEqual(tile.Length, 243);
        }
示例#2
0
        public void FetchTile()
        {
            Exception error = null;

            byte[] image = null;

            try
            {
                image = tileProvider.GetTile(tileInfo);
            }
            catch (Exception ex) //This may seem a bit weird. We catch the exception to pass it as an argument. This is because we are on a worker thread here, we cannot just let it fall through.
            {
                error = ex;
            }
            this.fetchTileCompleted(this, new FetchTileCompletedEventArgs(error, false, tileInfo, image));
        }