Exemplo n.º 1
0
 public void FeatureCollection_SerializeValid()
 {
     var p    = new Point(new Position(0, 0));
     var l    = new Line(new [] { new Position(0, 0), new Position(10, 10) });
     var f1   = new Feature(p, null);
     var f2   = new Feature(l, null);
     var fc   = new FeatureCollection(new[] { f1, f2 });
     var json = JsonConvert.SerializeObject(fc);
 }
Exemplo n.º 2
0
        public void Line_Serialize_Valid()
        {
            var a    = new Position(0, 0);
            var b    = new Position(5, 5);
            var l    = new Line(new[] { a, b });
            var json = JsonConvert.SerializeObject(l);
            var newL = JsonConvert.DeserializeObject <Line>(json);

            Assert.Equal(a, newL.Coordinates[0]);
            Assert.Equal(b, newL.Coordinates[1]);
            Assert.Equal("Line", newL.Type);
        }