コード例 #1
0
        public void MemoryDatasource_Add()
        {
            var options        = new Dictionary <string, object>();
            MemoryDatasource d = new MemoryDatasource(options);

            d.Add(1, 2);
            Featureset fs       = d.Featureset();
            Feature    f        = fs.Next();
            string     expected = @"{""type"":""Feature"",""id"":1,""geometry"":{""type"":""Point"",""coordinates"":[1,2]},""properties"":{}}";
            string     json     = f.ToJSON();

            Assert.AreEqual(expected, json);
            // should only have 1 feature
            f = fs.Next();
            Assert.IsNull(f);
        }
コード例 #2
0
        public void MemoryDatasource_AddWithProps()
        {
            var options        = new Dictionary <string, object>();
            MemoryDatasource d = new MemoryDatasource(options);
            var props          = new Dictionary <string, object>()
            {
                { "string_field", "text" },
                { "int_field", 1 },
                { "double_field", .124 }
            };

            d.Add(1, 2, props);
            Featureset fs       = d.Featureset();
            Feature    f        = fs.Next();
            string     expected = @"{""type"":""Feature"",""id"":1,""geometry"":{""type"":""Point"",""coordinates"":[1,2]},""properties"":{""double_field"":0.124,""int_field"":1,""string_field"":""text""}}";
            string     json     = f.ToJSON();

            Assert.AreEqual(expected, json);
            // should only have 1 feature
            f = fs.Next();
            Assert.IsNull(f);
        }
コード例 #3
0
 public void MemoryDatasource_AddWithProps()
 {
     var options = new Dictionary<string, object>();
     MemoryDatasource d = new MemoryDatasource(options);
     var props = new Dictionary<string, object>()
     {
         {"string_field", "text" },
         {"int_field", 1 },
         {"double_field", .124 }
     };
     d.Add(1, 2, props);
     Featureset fs = d.Featureset();
     Feature f = fs.Next();
     string expected = @"{""type"":""Feature"",""id"":1,""geometry"":{""type"":""Point"",""coordinates"":[1,2]},""properties"":{""double_field"":0.124,""int_field"":1,""string_field"":""text""}}";
     string json = f.ToJSON();
     Assert.AreEqual(expected, json);
     // should only have 1 feature
     f = fs.Next();
     Assert.IsNull(f);
 }
コード例 #4
0
 public void MemoryDatasource_Add()
 {
     var options = new Dictionary<string, object>();
     MemoryDatasource d = new MemoryDatasource(options);
     d.Add(1, 2);
     Featureset fs = d.Featureset();
     Feature f = fs.Next();
     string expected = @"{""type"":""Feature"",""id"":1,""geometry"":{""type"":""Point"",""coordinates"":[1,2]},""properties"":{}}";
     string json = f.ToJSON();
     Assert.AreEqual(expected, json);
     // should only have 1 feature
     f = fs.Next();
     Assert.IsNull(f);
 }