Esempio n. 1
0
        public void MemoryDatasource_Init()
        {
            var options = new Dictionary<string, object>();
            MemoryDatasource d = new MemoryDatasource(options);

            IDictionary<string, object> prms = d.Paramemters();
            Assert.AreEqual(1, prms.Count);
            Assert.AreEqual("memory", prms["type"]);

            IDictionary<string, object> desc = d.Describe();
            Assert.AreEqual("vector", desc["type"]);
            Assert.AreEqual("utf-8", desc["encoding"]);
            Assert.AreEqual("collection", desc["geometry_type"]);
            var fields = (Dictionary<string, string>)desc["fields"];
            Assert.AreEqual(0, fields.Count);
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public void MemoryDatasource_Init()
        {
            var options        = new Dictionary <string, object>();
            MemoryDatasource d = new MemoryDatasource(options);

            IDictionary <string, object> prms = d.Paramemters();

            Assert.AreEqual(1, prms.Count);
            Assert.AreEqual("memory", prms["type"]);

            IDictionary <string, object> desc = d.Describe();

            Assert.AreEqual("vector", desc["type"]);
            Assert.AreEqual("utf-8", desc["encoding"]);
            Assert.AreEqual("collection", desc["geometry_type"]);
            var fields = (Dictionary <string, string>)desc["fields"];

            Assert.AreEqual(0, fields.Count);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
 }
Esempio n. 6
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);
 }