forked from jbrwn/NET-Mapnik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LayerTest.cs
46 lines (41 loc) · 1.52 KB
/
LayerTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NETMapnik;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
namespace NETMapnik.Test
{
[TestClass]
public class LayerTest
{
[TestMethod]
public void Layer_Creation()
{
Layer l = new Layer("layer", "+init=epsg:4326");
Assert.AreEqual(l.Name, "layer");
Assert.AreEqual(l.SRS, "+init=epsg:4326");
CollectionAssert.AreEquivalent(l.Styles.ToList(), new List<string>());
Assert.IsNull(l.Datasource);
}
[TestMethod]
public void Layer_Describe()
{
Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input"));
Dictionary<string, object> options = new Dictionary<string, object>()
{
{ "type","shape"},
{ "file", @".\data\world_merc.shp" }
};
Datasource ds = new Datasource(options);
Layer l = new Layer("layer", "+init=epsg:4326");
l.Datasource = ds;
IDictionary<string, object> d = l.Describe();
Assert.AreEqual((string)d["name"], "layer");
Assert.AreEqual((string)d["srs"], "+init=epsg:4326");
CollectionAssert.AreEquivalent(((List<string>)d["styles"]), new List<string>());
CollectionAssert.AreEquivalent((Dictionary<string, object>)d["datasource"], options);
}
}
}