public virtual void PixelXToLongitudeTest() { foreach (int tileSize in TILE_SIZES) { for (sbyte zoomLevel = ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) { long mapSize = MercatorProjection.GetMapSize(zoomLevel, tileSize); double longitude = MercatorProjection.PixelXToLongitude(0, mapSize); Assert.AreEqual(LatLongUtils.LONGITUDE_MIN, longitude, 0); longitude = MercatorProjection.PixelXToLongitudeWithScaleFactor(0, MercatorProjection.ZoomLevelToScaleFactor(zoomLevel), tileSize); Assert.AreEqual(LatLongUtils.LONGITUDE_MIN, longitude, 0); longitude = MercatorProjection.PixelXToLongitude((float)mapSize / 2, mapSize); Assert.AreEqual(0, longitude, 0); mapSize = MercatorProjection.GetMapSizeWithScaleFactor(MercatorProjection.ZoomLevelToScaleFactor(zoomLevel), tileSize); longitude = MercatorProjection.PixelXToLongitudeWithScaleFactor((float)mapSize / 2, MercatorProjection.ZoomLevelToScaleFactor(zoomLevel), tileSize); Assert.AreEqual(0, longitude, 0); longitude = MercatorProjection.PixelXToLongitude(mapSize, mapSize); Assert.AreEqual(LatLongUtils.LONGITUDE_MAX, longitude, 0); longitude = MercatorProjection.PixelXToLongitudeWithScaleFactor(mapSize, MercatorProjection.ZoomLevelToScaleFactor(zoomLevel), tileSize); Assert.AreEqual(LatLongUtils.LONGITUDE_MAX, longitude, 0); } VerifyInvalidPixelXToLongitude(-1, (sbyte)0, tileSize); VerifyInvalidPixelXToLongitude(tileSize + 1, (sbyte)0, tileSize); } }