Ejemplo n.º 1
0
 public void PalanarPointTest()
 {
     {
         PlanarPointDTO pp = new PlanarPointDTO(10, 20);
         Assert.True(pp.X == 10);
         Assert.True(pp.Y == 20);
         {
             PlanarPointDTO other = new PlanarPointDTO(10, 20);
             Assert.True(pp.CompareTo(other) == 0);
         }
         {
             PlanarPointDTO other = new PlanarPointDTO(100, 20);
             Assert.True(pp.CompareTo(other) < 0);
         }
         {
             PlanarPointDTO other = new PlanarPointDTO(1, 20);
             Assert.True(pp.CompareTo(other) > 0);
         }
         {
             PlanarPointDTO other = new PlanarPointDTO(10, 200);
             Assert.True(pp.CompareTo(other) < 0);
         }
         {
             PlanarPointDTO other = new PlanarPointDTO(10, 2);
             Assert.True(pp.CompareTo(other) > 0);
         }
     }
 }
Ejemplo n.º 2
0
        /// <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");
            }
        }