/// <summary> /// Read IJsonMarshalable values from the named child property. /// </summary> /// <param name="jObj">JSON parent container.</param> /// <returns>IJsonMarshalable values.</returns> private static IJsonMarshalable ReadJsonMarshable(this JObject jObj) { String actualClassName = jObj[ComponentFieldForJson.CLASS]?.Value <String>(); switch (actualClassName) { case null: throw new Exception($"{TErr} Missing CLASS Declaration"); case ConceptChronologyDTO.JSONCLASSNAME: return(ConceptChronologyDTO.Make(jObj)); case ConceptDTO.JSONCLASSNAME: return(ConceptDTO.Make(jObj)); case PatternChronologyDTO.JSONCLASSNAME: return(PatternChronologyDTO.Make(jObj)); case PatternDTO.JSONCLASSNAME: return(PatternDTO.Make(jObj)); case SemanticChronologyDTO.JSONCLASSNAME: return(SemanticChronologyDTO.Make(jObj)); case SemanticDTO.JSONCLASSNAME: return(SemanticDTO.Make(jObj)); case SpatialPointDTO.JSONCLASSNAME: return(SpatialPointDTO.Make(jObj)); case PlanarPointDTO.JSONCLASSNAME: return(PlanarPointDTO.Make(jObj)); default: throw new NotImplementedException($"Class {actualClassName} not known"); } }
public void SpatialPointTest() { { SpatialPointDTO pp = new SpatialPointDTO(10, 20, 30); Assert.True(pp.X == 10); Assert.True(pp.Y == 20); Assert.True(pp.Z == 30); { SpatialPointDTO other = new SpatialPointDTO(10, 20, 30); Assert.True(pp.CompareTo(other) == 0); } { SpatialPointDTO other = new SpatialPointDTO(100, 20, 30); Assert.True(pp.CompareTo(other) < 0); } { SpatialPointDTO other = new SpatialPointDTO(1, 20, 30); Assert.True(pp.CompareTo(other) > 0); } { SpatialPointDTO other = new SpatialPointDTO(10, 200, 30); Assert.True(pp.CompareTo(other) < 0); } { SpatialPointDTO other = new SpatialPointDTO(10, 2, 30); Assert.True(pp.CompareTo(other) > 0); } { SpatialPointDTO other = new SpatialPointDTO(10, 20, 300); Assert.True(pp.CompareTo(other) < 0); } { SpatialPointDTO other = new SpatialPointDTO(10, 20, 3); Assert.True(pp.CompareTo(other) > 0); } } }