public void CreateTest() { var res = ObjectFactory.CreateTileSetDefinition(new Version(3, 0, 0)); Assert.IsAssignableFrom <ITileSetDefinition>(res); ITileSetDefinition tsd = (ITileSetDefinition)res; Assert.Equal("Default", tsd.TileStoreParameters.TileProvider); tsd.SetXYZProviderParameters(); Assert.Equal("XYZ", tsd.TileStoreParameters.TileProvider); var p = tsd.GetParameter("TileFormat"); Assert.NotNull(p); Assert.Equal("PNG", p.Value); Assert.Equal("PNG", tsd.GetTileFormat()); p = tsd.GetParameter("TilePath"); Assert.NotNull(p); Assert.Equal("%MG_TILE_CACHE_PATH%", p.Value); Assert.Equal("%MG_TILE_CACHE_PATH%", tsd.GetTilePath()); tsd.SetDefaultProviderParameters(256, 256, "coordsys", new double[] { 100.5, 200.5, 300.5 }); p = tsd.GetParameter("TileWidth"); Assert.NotNull(p); Assert.Equal("256", p.Value); Assert.Equal(256, tsd.GetDefaultTileWidth()); p = tsd.GetParameter("TileHeight"); Assert.NotNull(p); Assert.Equal("256", p.Value); Assert.Equal(256, tsd.GetDefaultTileHeight()); p = tsd.GetParameter("CoordinateSystem"); Assert.NotNull(p); Assert.Equal("coordsys", p.Value); Assert.Equal("coordsys", tsd.GetDefaultCoordinateSystem()); p = tsd.GetParameter("FiniteScaleList"); Assert.NotNull(p); Assert.Equal("300.5,200.5,100.5", p.Value); var value = tsd.GetDefaultFiniteScaleList(); Assert.Equal(3, value.Length); Assert.Contains(100.5, value); Assert.Contains(200.5, value); Assert.Contains(300.5, value); p = tsd.GetParameter("TileFormat"); Assert.NotNull(p); Assert.Equal("PNG", p.Value); Assert.Equal("PNG", tsd.GetTileFormat()); p = tsd.GetParameter("TilePath"); Assert.NotNull(p); Assert.Equal("%MG_TILE_CACHE_PATH%", p.Value); Assert.Equal("%MG_TILE_CACHE_PATH%", tsd.GetTilePath()); }
public void DeserializationTest() { var res = ObjectFactory.DeserializeXml(Properties.Resources.UT_BaseMap); Assert.IsInstanceOf <ITileSetDefinition>(res); ITileSetDefinition tsd = (ITileSetDefinition)res; Assert.AreEqual("%MG_TILE_CACHE_PATH%", tsd.GetTilePath()); Assert.AreEqual(256, tsd.GetDefaultTileWidth()); Assert.AreEqual(256, tsd.GetDefaultTileHeight()); Assert.AreEqual("PNG", tsd.GetTileFormat()); var values = tsd.GetDefaultFiniteScaleList(); Assert.AreEqual(10, values.Length); Assert.Contains(200000, values); Assert.Contains(100000, values); Assert.Contains(50000, values); Assert.Contains(25000, values); Assert.Contains(12500, values); Assert.Contains(6250, values); Assert.Contains(3125, values); Assert.Contains(1562.5, values); Assert.Contains(781.25, values); Assert.Contains(390.625, values); Assert.False(String.IsNullOrEmpty(tsd.GetDefaultCoordinateSystem())); var ext = tsd.Extents; Assert.AreEqual(-87.79786601383196, ext.MinX); Assert.AreEqual(-87.66452777186925, ext.MaxX); Assert.AreEqual(43.6868578621819, ext.MinY); Assert.AreEqual(43.8037962206133, ext.MaxY); Assert.AreEqual(1, tsd.BaseMapLayerGroups.Count()); var grp = tsd.BaseMapLayerGroups.First(); Assert.AreEqual("BaseLayers", grp.Name); Assert.True(grp.Visible); Assert.True(grp.ShowInLegend); Assert.True(grp.ExpandInLegend); Assert.AreEqual("Base Layers", grp.LegendLabel); Assert.AreEqual(2, grp.BaseMapLayer.Count()); }