Esempio n. 1
0
        public void ParseLiteral_With_Invalid_Coordinates_Throws()
        {
            // arrange
            var type       = new GeoJsonPositionType();
            var coordinate = new StringValueNode("2.2");

            // act
            // assert
            Assert.Throws <SerializationException>(() => type.ParseLiteral(coordinate));
        }
Esempio n. 2
0
        public void ParseLiteral_NullType_Null()
        {
            // arrange
            var           type       = new GeoJsonPositionType();
            NullValueNode coordinate = NullValueNode.Default;

            // act
            object?result = type.ParseLiteral(coordinate);

            // assert
            Assert.Null(result);
        }
Esempio n. 3
0
        public void ParseLiteral_With_2Valid_Coordinates()
        {
            // arrange
            var type       = new GeoJsonPositionType();
            var coordinate = new ListValueNode(
                new FloatValueNode(1.0),
                new IntValueNode(2));

            // act
            object?result = type.ParseLiteral(coordinate);

            // assert
            Assert.Equal(1.0, Assert.IsType <Coordinate>(result).X);
            Assert.Equal(2, Assert.IsType <Coordinate>(result).Y);
        }