public void AddLayerTest()
        {
            var          target   = new DemographicsSet_Accessor();
            const string fileName = "layer1.compiled.json";

            target.AddLayer(fileName);
            Assert.AreEqual(1, target._layers.Count);
            Assert.IsNotNull(target._baseLayer);
            Assert.AreEqual(fileName, target._baseLayer.FileName);
            const string layer2 = "layer2.compiled.json";

            target.AddLayer(layer2);
            Assert.AreEqual(2, target._layers.Count);
            Assert.AreEqual(layer2, target._layers.Peek().FileName);
        }
        public void GetNodeDataTest()
        {
            var target = new DemographicsSet_Accessor();

            target.AddLayer("layer1.compiled.json");
            const int nodeId = 1970;
            NodeData  actual = target.GetNodeData(nodeId);

            Assert.AreEqual("Milwaukee, WI", actual.GetString("NodeAttributes.Name"));
            Assert.AreEqual(43.038812, actual.GetDouble("NodeAttributes.Latitude"));
            Assert.AreEqual(-87.906824, actual.GetDouble("NodeAttributes.Longitude"));
            Assert.AreEqual(596974, actual.GetInteger("NodeAttributes.InitialPopulation"));
        }
        public void NodeIDsTest()
        {
            var target = new DemographicsSet_Accessor();

            target.AddLayer("layer2.compiled.json");
            IList <int> expected = new List <int>(new[] { 1968, 1970, 1995, 2000 });
            IList <int> actual   = target.NodeIDs;

            Assert.AreEqual(expected.Count, actual.Count);
            foreach (int id in expected)
            {
                Assert.IsTrue(actual.Contains(id));
            }
        }
        public void LayersTest()
        {
            var target = new DemographicsSet_Accessor();

            Assert.AreEqual(0, target.Layers.Count());
            target.AddLayer("layer1.compiled.json");
            // actual = target.Layers;
            Assert.AreEqual(1, target.Layers.Count());
            DemographicsLayer layer = target.Layers.First();

            Assert.AreEqual("layer1.compiled.json", layer.FileName);
            Assert.IsTrue(layer.ContainsNode(1995));
            IDictionary <string, string> stringTable = layer.StringTable;

            Assert.AreEqual("ah", stringTable["Seaport"]);
            target.AddLayer("layer2.compiled.json");
            Assert.AreEqual(2, target.Layers.Count());
            layer = target.Layers.First();
            Assert.AreEqual("layer2.compiled.json", layer.FileName);
            Assert.IsTrue(layer.ContainsNode(2000));
            stringTable = layer.StringTable;
            Assert.AreEqual("ac", stringTable["InitialPopulation"]);
        }