public void NodeDataConstructorTest() { const int nodeId = 2000; DemographicsSet parentSet = DemographicsSet.CreateDemographicsSet(); parentSet.AddLayer("layer1.compiled.json"); var target = new NodeData_Accessor(nodeId, parentSet); Assert.AreEqual("San Diego, CA", target.GetString("NodeAttributes:Name")); Assert.AreEqual(1223400, target.GetInteger("NodeAttributes/InitialPopulation")); }
public void GetDoubleTest() { DemographicsSet set = DemographicsSet.CreateDemographicsSet(); set.AddLayer("layer1.compiled.json"); var param0 = new PrivateObject(set.GetNodeData(1970)); var target = new NodeData_Accessor(param0); const string key = "NodeAttributes.Latitude"; const double expected = 43.038812; double actual = target.GetDouble(key); Assert.AreEqual(expected, actual); }
public void GetStringTest() { DemographicsSet set = DemographicsSet.CreateDemographicsSet(); set.AddLayer("layer1.compiled.json"); var param0 = new PrivateObject(set.GetNodeData(1970)); var target = new NodeData_Accessor(param0); const string expected = "Milwaukee, WI"; const string key = "NodeAttributes:Name"; string actual = target.GetString(key); Assert.AreEqual(expected, actual); }
public void GetIntegerTest() { DemographicsSet set = DemographicsSet.CreateDemographicsSet(); set.AddLayer("layer1.compiled.json"); var param0 = new PrivateObject(set.GetNodeData(1970)); var target = new NodeData_Accessor(param0); const string key = "NodeAttributes.InitialPopulation"; const int expected = 596974; int actual = target.GetInteger(key); Assert.AreEqual(expected, actual); }
public void GetFloatTest() { DemographicsSet set = DemographicsSet.CreateDemographicsSet(); set.AddLayer("layer1.compiled.json"); var param0 = new PrivateObject(set.GetNodeData(1970)); var target = new NodeData_Accessor(param0); const string key = "NodeAttributes.Longitude"; const float expected = -87.906824F; float actual = target.GetFloat(key); Assert.AreEqual(expected, actual); }
public void GetValueTest() { DemographicsSet set = DemographicsSet.CreateDemographicsSet(); set.AddLayer("layer1.compiled.json"); set.AddLayer("layer2.compiled.json"); set.AddLayer("layer3.compiled.json"); var param0 = new PrivateObject(set.GetNodeData(1970)); var target = new NodeData_Accessor(param0); const string key = "NodeAttributes:Census Date"; JsonElement actual = target.GetValue(key); Assert.IsNotNull(actual); Assert.AreEqual(2010, ((JsonNumber)actual).Value); }
public void GetObjectEntryTest() { IEnumerable <string> keys = new[] { "NodeAttributes", "InitialPopulation" }; JsonElement obj = new JsonObject(); ((JsonObject)obj).Add("ab", new JsonObject()); ((JsonObject)(((JsonObject)obj)["ab"])).Add("ag", new JsonNumber { Value = 596974 }); IDictionary <string, string> stringTable = new Dictionary <string, string>(); stringTable.Add("NodeAttributes", "ab"); stringTable.Add("InitialPopulation", "ag"); JsonElement actual = NodeData_Accessor.GetObjectEntry(keys, obj, stringTable); var population = actual as JsonNumber; Assert.IsNotNull(population); Assert.AreEqual(596974, population.Value); }